React-native-onesignal: Fails with OneSignal Pod 2.0.8

Created on 17 Aug 2016  路  8Comments  路  Source: OneSignal/react-native-onesignal

After updating my podfile, the native iOS code was causing a crash on launch.

This initWithLaunchOptions code block was causing the crash, and I couldn't seem to fix it:

self.oneSignal = [[RCTOneSignal alloc] initWithLaunchOptions:launchOptions
                                                         appId:ONESIGNAL_APP_ID
                                                  autoRegister:FALSE];

Console output:

2016-08-17 13:51:59.726 Sixcycle 伪[64163:3710719] -[OneSignal initWithLaunchOptions:appId:handleNotification:autoRegister:]: unrecognized selector sent to instance 0x7fd1084d7e80
2016-08-17 13:51:59.736 Sixcycle 伪[64163:3710719] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[OneSignal initWithLaunchOptions:appId:handleNotification:autoRegister:]: unrecognized selector sent to instance 0x7fd1084d7e80'
*** First throw call stack:
(
    0   CoreFoundation                      0x000000011443ed85 __exceptionPreprocess + 165
    1   libobjc.A.dylib                     0x00000001136d7deb objc_exception_throw + 48
    2   CoreFoundation                      0x0000000114447d3d -[NSObject(NSObject) doesNotRecognizeSelector:] + 205
    3   CoreFoundation                      0x000000011438dcfa ___forwarding___ + 970
    4   CoreFoundation                      0x000000011438d8a8 _CF_forwarding_prep_0 + 120
    5   Sixcycle 艗卤                         0x000000010fc35068 -[RCTOneSignal initWithLaunchOptions:appId:autoRegister:] + 264
    6   Sixcycle 艗卤                         0x000000010f90462d -[AppDelegate application:didFinishLaunchingWithOptions:] + 397
    7   UIKit                               0x00000001120409ac -[UIApplication _handleDelegateCallbacksWithOptions:isSuspended:restoreState:] + 272
    8   UIKit                               0x0000000112041c0d -[UIApplication _callInitializationDelegatesForMainScene:transitionContext:] + 3415
    9   UIKit                               0x0000000112048568 -[UIApplication _runWithMainScene:transitionContext:completion:] + 1769
    10  UIKit                               0x0000000112045714 -[UIApplication workspaceDidEndTransaction:] + 188
    11  FrontBoardServices                  0x00000001171968c8 __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__ + 24
    12  FrontBoardServices                  0x0000000117196741 -[FBSSerialQueue _performNext] + 178
    13  FrontBoardServices                  0x0000000117196aca -[FBSSerialQueue _performNextFromRunLoopSource] + 45
    14  CoreFoundation                      0x0000000114364301 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
    15  CoreFoundation                      0x000000011435a22c __CFRunLoopDoSources0 + 556
    16  CoreFoundation                      0x00000001143596e3 __CFRunLoopRun + 867
    17  CoreFoundation                      0x00000001143590f8 CFRunLoopRunSpecific + 488
    18  UIKit                               0x0000000112044f21 -[UIApplication _run] + 402
    19  UIKit                               0x0000000112049f09 UIApplicationMain + 171
    20  Sixcycle 艗卤                         0x000000010f9050bf main + 111
    21  libdyld.dylib                       0x000000011575992d start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException

I have downgraded to 1.13.3, and it is now working as expected again.

Most helpful comment

@kristojorg Temporary fix:
Replace pod 'OneSignal' with pod 'OneSignal', '~> 1.13.2' and run a pod update. Should restrict CocoaPods from fetching the latest OneSignal SDK version and rather get the 1.13.3 version which is compatible with the ios react-native wrapper.

All 8 comments

Hi,

We've updated our native iOS SDK to 2.0.9 but have not propagated the releases into all the platforms we support yet. Will do a pull request fixing adding support to the latest SDK and fixing this issue.

@kristojorg Temporary fix:
Replace pod 'OneSignal' with pod 'OneSignal', '~> 1.13.2' and run a pod update. Should restrict CocoaPods from fetching the latest OneSignal SDK version and rather get the 1.13.3 version which is compatible with the ios react-native wrapper.

I did that thank you very much @JKalash , please inform when the new version is out !

We're currently testing the new version, which apparently solves this issue.

What about installs without pod ?

If the SDK manually configured, 1.13.3 could be downloaded from here,
https://github.com/OneSignal/OneSignal-iOS-SDK/releases/tag/1.13.3

We're getting closer to upgrade this library to the new SDK, probably in a couple of days.

Was this page helpful?
0 / 5 - 0 ratings