react-native-fcm: Can't build on Xcode 8.2

Before openning an issue

  1. Reproduce it with the example project in this repo.
  2. If you can’t receive iOS notification, make sure you can receive notification using quickstart-ios project provided by Firebase team

When openning an issue, please include following information for better support

  1. What version of RN and react-native-fcm are you running? RN 0.52 & RNFCM 13.1.0
  2. What device are you using? (e.g iOS9 emulator, Android 6 device)? iOS
  3. Is your app running in foreground, background or not running?

Previously I can build, but I don’t know since when it can’t build again on current Xcode 8.2.

I get an error like this:

/Users/pewh/Documents/KLOP/node_modules/react-native-fcm/ios/RNFIRMessaging.m:196:13: error: unexpected '@' in program
        if (@available(iOS 11.0, *)) {
            ^
/Users/pewh/Documents/KLOP/node_modules/react-native-fcm/ios/RNFIRMessaging.m:197:44: error: no known class method for selector 'categoryWithIdentifier:actions:intentIdentifiers:hiddenPreviewsBodyPlaceholder:options:'
            return [UNNotificationCategory categoryWithIdentifier:identifier actions:actions intentIdentifiers:intentIdentifiers hiddenPreviewsBodyPlaceholder:hiddenPreviewsBodyPlaceholder options:options];
                                           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/pewh/Documents/KLOP/node_modules/react-native-fcm/ios/RNFIRMessaging.m:211:118: error: use of undeclared identifier 'UNNotificationCategoryOptionHiddenPreviewsShowTitle'
                                                           @"UNNotificationCategoryOptionHiddenPreviewsShowTitle": @(UNNotificationCategoryOptionHiddenPreviewsShowTitle),
                                                                                                                     ^
/Users/pewh/Documents/KLOP/node_modules/react-native-fcm/ios/RNFIRMessaging.m:212:121: error: use of undeclared identifier 'UNNotificationCategoryOptionHiddenPreviewsShowSubtitle'
                                                           @"UNNotificationCategoryOptionHiddenPreviewsShowSubtitle": @(UNNotificationCategoryOptionHiddenPreviewsShowSubtitle),
                                                                                                                        ^
4 errors generated.
Command /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang failed with exit code 1

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 15 (10 by maintainers)

Most upvoted comments

For a temporary fix and to be able to build, add the following to RNFIRMessaging.m:

const UNNotificationCategoryOptionHiddenPreviewsShowTitle = (1 << 2);
const UNNotificationCategoryOptionHiddenPreviewsShowSubtitle = (1 << 3);