i'm trying push notifications working in react native ios app. i'm following tutorial pushnotificationsios. have manually linked library well.
in appdelegate.m file looks follows,
/** * copyright (c) 2015-present, facebook, inc. * rights reserved. * * source code licensed under bsd-style license found in * license file in root directory of source tree. additional grant * of patent rights can found in patents file in same directory. */ #import "rctpushnotificationmanager.h" #import "appdelegate.h" #import "rctrootview.h" @implementation appdelegate // required register notifications - (void)application:(uiapplication *)application didregisterusernotificationsettings:(uiusernotificationsettings *)notificationsettings { [rctpushnotificationmanager didregisterusernotificationsettings:notificationsettings]; } // required register event. - (void)application:(uiapplication *)application didregisterforremotenotificationswithdevicetoken:(nsdata *)devicetoken { [rctpushnotificationmanager didregisterforremotenotificationswithdevicetoken:devicetoken]; } // required notification event. - (void)application:(uiapplication *)application didreceiveremotenotification:(nsdictionary *)notification { [rctpushnotificationmanager didreceiveremotenotification:notification]; } - (bool)application:(uiapplication *)application didfinishlaunchingwithoptions:(nsdictionary *)launchoptions { nsurl *jscodelocation; /** * loading javascript code - uncomment 1 want. * * option 1 * load development server. start server repository root: * * $ npm start * * run on device, change `localhost` ip address of computer * (you can typing `ifconfig` terminal , selecting * `inet` value under `en0:`) , make sure computer , ios device * on same wi-fi network. */ //jscodelocation = [nsurl urlwithstring:@"http://172.16.2.173:8081/index.ios.bundle?platform=ios&dev=true"]; jscodelocation = [nsurl urlwithstring:@"http://localhost:8081/index.ios.bundle?platform=ios&dev=true"]; /** * option 2 * load pre-bundled file on disk. static bundle automatically * generated "bundle react native code , images" build step. */ //jscodelocation = [[nsbundle mainbundle] urlforresource:@"main" withextension:@"jsbundle"]; rctrootview *rootview = [[rctrootview alloc] initwithbundleurl:jscodelocation modulename:@"myapp" initialproperties:nil launchoptions:launchoptions]; self.window = [[uiwindow alloc] initwithframe:[uiscreen mainscreen].bounds]; uiviewcontroller *rootviewcontroller = [uiviewcontroller new]; rootviewcontroller.view = rootview; self.window.rootviewcontroller = rootviewcontroller; [self.window makekeyandvisible]; return yes; } @end
but build fails errors,
no known class method selector 'didregisterusernotificationsettings:' no known class method selector 'didregisterforremotenotificationswithdevicetoken:' no known class method selector 'didreceiveremotenotification:'
why this? how fix this?
ps: note
found alternative , worked fine. apple push notification services in ios 6 tutorial
please follow easy , simple raywenderlich tutorial. apns tutorial hope helps you.
Comments
Post a Comment