ibm-bluemix-mobile-services/bms-clientsdk-cordova-plugin-push

Breaks when starting iOS application

Opened this issue · 0 comments

Can not start iOS app after finish the steps written inside the readme.sh

Error Message 01 in xCode Debug:

2017-01-21 18:00:20.153761 SimpleConversationApp[1691:1290476] Apache Cordova native platform version 4.3.1 is starting.
2017-01-21 18:00:20.154611 SimpleConversationApp[1691:1290476] Multi-tasking -> Device: YES, App: YES
fatal error: unexpectedly found nil while unwrapping an Optional value
2017-01-21 18:00:20.167528 SimpleConversationApp[1691:1290476] fatal error: unexpectedly found nil while unwrapping an Optional value
(lldb) 

Error Message 01 in xCode Thread:

libswiftCore.dylib`function signature specialization <preserving fragile attribute, Arg[2] = Dead, Arg[3] = Dead> of Swift._fatalErrorMessage (Swift.StaticString, Swift.StaticString, Swift.StaticString, Swift.UInt, flags : Swift.UInt32) -> Swift.Never:
    0x100631184 <+0>:   stp    x26, x25, [sp, #-80]!
    0x100631188 <+4>:   stp    x24, x23, [sp, #16]
    0x10063118c <+8>:   stp    x22, x21, [sp, #32]
    0x100631190 <+12>:  stp    x20, x19, [sp, #48]
    0x100631194 <+16>:  stp    x29, x30, [sp, #64]
    0x100631198 <+20>:  add    x29, sp, #64              ; =64 
    0x10063119c <+24>:  mov    x19, x6
    0x1006311a0 <+28>:  mov    x20, x5
    0x1006311a4 <+32>:  mov    x21, x4
    0x1006311a8 <+36>:  mov    x22, x3
    0x1006311ac <+40>:  mov    x23, x2
    0x1006311b0 <+44>:  mov    x24, x1
    0x1006311b4 <+48>:  mov    x25, x0
    0x1006311b8 <+52>:  adr    x8, #936936               ; protocol descriptor for Swift.CVarArg + 88
    0x1006311bc <+56>:  nop    
    0x1006311c0 <+60>:  add    x0, x8, #16               ; =16 
    0x1006311c4 <+64>:  movz   w1, #0x28
    0x1006311c8 <+68>:  orr    w2, wzr, #0x7
    0x1006311cc <+72>:  bl     0x1006314b0               ; rt_swift_allocObject
    0x1006311d0 <+76>:  mov    x8, x0
    0x1006311d4 <+80>:  stp    x22, x21, [x8, #16]
    0x1006311d8 <+84>:  strb   w20, [x8, #32]
    0x1006311dc <+88>:  str    w19, [x8, #36]
    0x1006311e0 <+92>:  adr    x3, #241008               ; partial apply forwarder for Swift.(_fatalErrorMessage (Swift.StaticString, Swift.StaticString, Swift.StaticString, Swift.UInt, flags : Swift.UInt32) -> Swift.Never).(closure #2)
    0x1006311e4 <+96>:  nop    
    0x1006311e8 <+100>: mov    x0, x25
    0x1006311ec <+104>: mov    x1, x24
    0x1006311f0 <+108>: mov    x2, x23
    0x1006311f4 <+112>: mov    x4, x8
    0x1006311f8 <+116>: bl     0x100524b80               ; function signature specialization <preserving fragile attribute, Arg[1] = [Closure Propagated : reabstraction thunk helper from @callee_owned (@unowned Swift.UnsafeBufferPointer<Swift.UInt8>) -> () to @callee_owned (@unowned Swift.UnsafeBufferPointer<Swift.UInt8>) -> (@out ()), Argument Types : [@callee_owned (@unowned Swift.UnsafeBufferPointer<Swift.UInt8>) -> ()]> of generic specialization <preserving fragile attribute, ()> of Swift.StaticString.withUTF8Buffer <A> ((Swift.UnsafeBufferPointer<Swift.UInt8>) -> A) -> A
->  0x1006311fc <+120>: brk    #0x1

Environment:
xCode:
Version 8.2.1 (8C1002)

Cordova Plugin List:

bms-core 2.3.7 "BMSCore"
bms-push 3.1.2 "BMSPush"
cordova-plugin-add-swift-support 1.6.2 "AddSwiftSupport"
cordova-plugin-cocoapod-support 1.2.14 "Cordova CocoaPods Dependency Support"
cordova-plugin-console 1.0.5 "Console"
cordova-plugin-dialogs 1.3.1 "Notification"
cordova-plugin-spinner-dialog 1.3.1 "SpinnerDialog"
cordova-plugin-splashscreen 4.0.2-dev "Splashscreen"
cordova-plugin-whitelist 1.3.1 "Whitelist"

Cordova Platform List:

Installed platforms:
  android 6.0.0
  ios 4.3.1
Available platforms: 
  amazon-fireos ~3.6.3 (deprecated)
  blackberry10 ~3.8.0
  browser ~4.1.0
  firefoxos ~3.6.3
  osx ~4.0.1
  webos ~3.7.0

Relevant code inside cordova application www.js.app.js:

$ionicPlatform.ready(function() {
    // Hide the accessory bar by default (remove this to show the accessory bar above the keyboard
    // for form inputs)
    if (window.cordova && window.cordova.plugins && window.cordova.plugins.Keyboard) {
      cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);
      cordova.plugins.Keyboard.disableScroll(true);
    }
    if (window.StatusBar) {
      // org.apache.cordova.statusbar required
      StatusBar.styleDefault();
    }
    // -----------------------
    // BMS Begin
    console.log(">> ready 01: BMSClient.initialize");
    BMSClient.initialize(BMSClient.REGION_UK);//REGION_US_SOUTH);
    // iOS Actionable notification options.
    // Eg : {"category_Name":[{"identifier_name_1":"action_Name_1"},{"identifier_name_2":"action_Name_2"}]}
    // Pass empty for Android
    var category = {};
    console.log(">> ready 05: BMSPush.initialize");
    BMSPush.initialize(appGuid, clientSecret, category);

    console.log(">> ready 02: BMSLogger.setLogLevel");
    // Globally set the logging level
    BMSLogger.setLogLevel(BMSLogger.WARN);

    // Definition for the Notification callback
    var handleNotificationCallback = function(notification) {
            // notification is a JSON object
            alert(notification.message);
    };
    
    BMSPush.registerNotificationsCallback(handleNotificationCallback);
    // BMS  End
    // -----------------------

Relevant code inside code inside xcode classes.AppDelegate.m:

#import "SimpleConversationApp-swift.h"

@implementation AppDelegate

- (BOOL)application:(UIApplication*)application didFinishLaunchingWithOptions:(NSDictionary*)launchOptions
{
    self.viewController = [[MainViewController alloc] init];
    
    //-------- PUSH NOTIFICTIONS BLUEMIX BEGIN ---
    if (!launchOptions[UIApplicationLaunchOptionsRemoteNotificationKey]) {
      [[CDVBMSPush sharedInstance] didReceiveRemoteNotificationOnLaunchWithLaunchOptions:launchOptions];
    }
    //--------PUSH NOTIFICTIONS BLUEMIX END---
    
    return [super application:application didFinishLaunchingWithOptions:launchOptions];
}


//-------- PUSH NOTIFICTIONS BLUEMIX BEGIN ---
// Register device token with Bluemix Push Notification Service

- (void)application:(UIApplication *)application
didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken{
    
    [[CDVBMSPush sharedInstance] didRegisterForRemoteNotificationsWithDeviceToken:deviceToken];
}

// Handle error when failed to register device token with APNs
- (void)application:(UIApplication*)application
didFailToRegisterForRemoteNotificationsWithError:(NSError*)error {
    
    [[CDVBMSPush sharedInstance] didFailToRegisterForRemoteNotificationsWithError:error];
}

// Handle receiving a remote notification
-(void)application:(UIApplication *)application
didReceiveRemoteNotification:(NSDictionary *)userInfo
fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler {
    
    [[CDVBMSPush sharedInstance] didReceiveRemoteNotificationWithNotification:userInfo];
}
//--------PUSH NOTIFICTIONS BLUEMIX END---