diff --git a/LondonReact.xcodeproj/project.pbxproj b/LondonReact.xcodeproj/project.pbxproj index a97b7d8..f063c24 100644 --- a/LondonReact.xcodeproj/project.pbxproj +++ b/LondonReact.xcodeproj/project.pbxproj @@ -670,6 +670,7 @@ 13B07F941A680F5B00A75B9A /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; CODE_SIGN_IDENTITY = "iPhone Developer: David Wynne (WVKX278G5W)"; @@ -683,12 +684,14 @@ OTHER_LDFLAGS = "-ObjC"; PRODUCT_NAME = LondonReact; PROVISIONING_PROFILE = "d8f23040-5086-4316-ace8-ba8530e55286"; + USER_HEADER_SEARCH_PATHS = "$(SRCROOT)/node_modules/react-native/Libraries/**"; }; name = Debug; }; 13B07F951A680F5B00A75B9A /* Release */ = { isa = XCBuildConfiguration; buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; CODE_SIGN_IDENTITY = "iPhone Developer: David Wynne (WVKX278G5W)"; @@ -702,6 +705,7 @@ OTHER_LDFLAGS = "-ObjC"; PRODUCT_NAME = LondonReact; PROVISIONING_PROFILE = "d8f23040-5086-4316-ace8-ba8530e55286"; + USER_HEADER_SEARCH_PATHS = "$(SRCROOT)/node_modules/react-native/Libraries/**"; }; name = Release; }; diff --git a/iOS/AppDelegate.m b/iOS/AppDelegate.m index 20ddcc0..23b39c4 100644 --- a/iOS/AppDelegate.m +++ b/iOS/AppDelegate.m @@ -10,6 +10,7 @@ #import "AppDelegate.h" #import "RCTRootView.h" +#import "RCTPushNotificationManager.h" @implementation AppDelegate @@ -83,4 +84,14 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:( return YES; } +- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken +{ + [RCTPushNotificationManager application:application didRegisterForRemoteNotificationsWithDeviceToken:deviceToken]; +} + +- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)notification +{ + [RCTPushNotificationManager application:application didReceiveRemoteNotification:notification]; +} + @end diff --git a/index.ios.js b/index.ios.js index dcc05a2..e0f3712 100644 --- a/index.ios.js +++ b/index.ios.js @@ -31,11 +31,12 @@ class LondonReact extends React.Component { PushNotificationIOS.addEventListener('register', this._savePushToken); PushNotificationIOS.addEventListener('notification', this._notificationReceived); - PushNotificationIOS.requestPermissions(this._savePushToken); + PushNotificationIOS.requestPermissions(); } async _savePushToken(token) { await AsyncStorage.setItem('pushToken', token); await Parse.registerInstallation(token); + AlertIOS.alert(`Registered token: ${token}`); } async _registerInstallation() { let pushToken = await AsyncStorage.getItem('pushToken');