Issues Getting Started with React Native on iOS

Hey all,

I'm trying to use the react-native-module to integrate Urban Airship push notifications with our React Native mobile app.

I've followed all of the instructions in the README, as well as played around with iOS-specific instructions. However, I can't seem to get Urban Airship up and running with iOS - I'm consistently getting console.logs of Notifications enabled: false and Channel: undefined. I'm also not seeing an increment in "App Opens" in the dashboard when I build and run the app via Xcode. Everything works fine on Android. Any pointers as to what I'm missing?

 

Edit to add -- here's the errors in my console:

2017-05-30 14:50:24.311425-0500 ecosystem[582:223475] 🚨Urban Airship Implementation Error🚨 - AirshipConfig.plist file is missing. Unable to takeOff.

2017-05-30 14:50:24.312069-0500 ecosystem[582:223475] 🚨Urban Airship Implementation Error🚨 - AirshipConfig.plist file is missing. Unable to takeOff.

2017-05-30 14:50:24.338126-0500 ecosystem[582:223475] [E] +[UAirship handleAppDidFinishLaunchingNotification:]_block_invoke [Line 282] [UAirship takeOff] was not called in application:didFinishLaunchingWithOptions:

2017-05-30 14:50:24.338246-0500 ecosystem[582:223475] [E] +[UAirship handleAppDidFinishLaunchingNotification:]_block_invoke [Line 283] Please ensure that [UAirship takeOff] is called synchronously before application:didFinishLaunchingWithOptions: returns

 

I've tried putting the AirshipConfig.plist in both my target folder (like the README specified) as well as the ios folder (like the sample has), and the same error results with each. My AirshipConfig.plist looks like this:

 

#import "AppDelegate.h"

#import <React/RCTBundleURLProvider.h>
#import <React/RCTRootView.h>

@import AirshipKit;

@implementation AppDelegate

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
NSURL*jsCodeLocation;

jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index.ios" fallbackResource:nil];

RCTRootView *rootView = [[RCTRootView alloc] initWithBundleURL:jsCodeLocation
moduleName:@"ecosystem"
initialProperties:nil
launchOptions:launchOptions];
rootView.backgroundColor = [[UIColor alloc] initWithRed:1.0f green:1.0f blue:1.0f alpha:1];

self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
UIViewController *rootViewController = [UIViewController new];
rootViewController.view = rootView;
self.window.rootViewController = rootViewController;
[self.window makeKeyAndVisible];

// Call takeOff (which creates the UAirship singleton)
[UAirship takeOff];

returnYES;
}

@end
 
 
(I've also tried it without the import AirshipKit/takeOff code, per the React Native Getting Started guide, with the AirshipConfig.plist in both locations, to no avail.)

Didn't find what you were looking for?

New post

Comments

8 comments

  • Hi Sterling,

    Do you perhaps happen to have the rest of the logs from Xcode?

    I'm curious to see if there is anything else in there that might clue us in on what's going on in your app.

    Comment actions Permalink
    0
  • Hi Michael,

    Here's most of the logs--

    2017-05-30 15:06:24.440 [info][tid:main][RCTBatchedBridge.m:77] Initializing <RCTBatchedBridge: 0x1701abfa0> (parent: <RCTBridge: 0x1700d9ec0>, executor: RCTJSCExecutor)

    2017-05-30 15:06:24.447659-0500 ecosystem[591:225433] Initializing <RCTBatchedBridge: 0x1701abfa0> (parent: <RCTBridge: 0x1700d9ec0>, executor: RCTJSCExecutor)

    2017-05-30 15:06:24.565 [warn][tid:com.facebook.react.JavaScript][RCTModuleData.mm:220] RCTBridge required dispatch_sync to load RCTDevSettings. This may lead to deadlocks

    2017-05-30 15:06:24.565311-0500 ecosystem[591:225500] RCTBridge required dispatch_sync to load RCTDevSettings. This may lead to deadlocks

    2017-05-30 15:06:24.571227-0500 ecosystem[591:225433] 🚨Urban Airship Implementation Error🚨 - AirshipConfig.plist file is missing. Unable to takeOff.

    2017-05-30 15:06:24.571851-0500 ecosystem[591:225433] 🚨Urban Airship Implementation Error🚨 - AirshipConfig.plist file is missing. Unable to takeOff.

    2017-05-30 15:06:24.603254-0500 ecosystem[591:225433] [E] +[UAirship handleAppDidFinishLaunchingNotification:]_block_invoke [Line 282] [UAirship takeOff] was not called in application:didFinishLaunchingWithOptions:

    2017-05-30 15:06:24.603393-0500 ecosystem[591:225433] [E] +[UAirship handleAppDidFinishLaunchingNotification:]_block_invoke [Line 283] Please ensure that [UAirship takeOff] is called synchronously before application:didFinishLaunchingWithOptions: returns

    2017-05-30 15:06:24.973 [info][tid:main][RCTBatchedBridge.m:77] Initializing <RCTBatchedBridge: 0x1701abde0> (parent: <RCTBridge: 0x1700d9ec0>, executor: RCTWebSocketExecutor)

    2017-05-30 15:06:24.972869-0500 ecosystem[591:225433] Initializing <RCTBatchedBridge: 0x1701abde0> (parent: <RCTBridge: 0x1700d9ec0>, executor: RCTWebSocketExecutor)

    2017-05-30 15:06:27.715 [info][tid:main][RCTRootView.m:295] Running application ecosystem ({

        initialProps =     {

        };

        rootTag = 1;

    })

    2017-05-30 15:06:27.715635-0500 ecosystem[591:225433] Running application ecosystem ({

        initialProps =     {

        };

        rootTag = 1;

    })

    2017-05-30 15:06:27.740310-0500 ecosystem[591:225490] [] nw_connection_get_connected_socket_block_invoke 6 Connection has no connected handler

    2017-05-30 15:06:29.844653-0500 ecosystem[591:225488] [] nw_connection_get_connected_socket_block_invoke 8 Connection has no connected handler

    2017-05-30 15:06:31.860411-0500 ecosystem[591:225485] [] nw_connection_get_connected_socket_block_invoke 9 Connection has no connected handler

     

    I say most because after that, I repeatedly get the same error as the last 3, just with increasing numbers.

    Comment actions Permalink
    0
  • Sterling,

    Just making sure, are you saying that your AirshipConfig.plist has that Objective-C code in there? Or, can you provide the items in the plist?

    Comment actions Permalink
    0
  • Michael,

    Apologies, my AppDelegate.m code looked like what was in my original post.

    My AirshipConfig.plist looks like this--

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
    <plist version="1.0">
    <dict>
    <key>detectProvisioningMode</key>
    <true/>
    <key>developmentAppKey</key>
    <string>mydevappkeyhere</string>
    <key>developmentAppSecret</key>
    <string>mydevappsecrethere</string>
    <key>productionAppKey</key>
    <string>myproductionappkeyhere</string>
    <key>productionAppSecret</key>
    <string>myproductionappsecrethere</string>
    </dict>
    </plist>
     
    (I'm not sure if those keys/secrets should be protected or not, so I've substituted them with generic values for now. If they're okay to be shared, I can post them. Let me know.)
    Comment actions Permalink
    0
  • No worries! You don't need to share the app key or secrets, just so long the values are filled in with actual app keys.

    You probably won't need the [UAirship takeOff]; in your appDelegate.

    I know you said that you have the AirshipConfig.plist in your project. Would you be able to screenshot what that looks like within Xcode?

    Comment actions Permalink
    0
  • Yes, those values are filled in with the proper keys/secrets. :)

    Oooh, this may be the cause. In my code editor, my structure currently looks like this:

    But in Xcode, it doesn't seem to be there--

    Do I need to manually add that into Xcode? (e.g. something like this? - sorry, I'm kind of a newbie to Xcode!)

    Comment actions Permalink
    0
  • I manually added AirshipConfig.plist to Xcode, and it looks like everything is working as it should! Thank you SO much for all of your help, Michael!

    Comment actions Permalink
    0
  • No problem! Happy to help!

    Comment actions Permalink
    0

Please sign in to leave a comment.