The following code leads to app crash:
OneSignal.initWithLaunchOptions(launchOptions, appId: AppDelegate.OS_APP_ID,
handleNotificationReceived: {self.馃 ($0?.payload)},
handleNotificationAction: {_ in},
settings: [kOSSettingsKeyInFocusDisplayOption:OSNotificationDisplayType.none])
But it doesn't crash, when settings not set:
OneSignal.initWithLaunchOptions(launchOptions, appId: AppDelegate.OS_APP_ID,
handleNotificationReceived: {self.馃 ($0?.payload)},
handleNotificationAction: {_ in},
settings: [AnyHashable:Any]())
Error message:
2017-01-27 13:20:11.612 APP_NAME[1719:1007924] -[_SwiftValue integerValue]: unrecognized selector sent to instance 0x17f23420
2017-01-27 13:20:11.615 APP_NAME[1719:1007924] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[_SwiftValue integerValue]: unrecognized selector sent to instance 0x17f23420'
Full stack trace doesn't contain any app related calls.
Using Xcode 8.2.1, Swift 3
@rostopira For Swift you need to add rawValue to OSNotificationDisplayType.none.
settings: [kOSSettingsKeyInFocusDisplayOption:OSNotificationDisplayType.none.rawValue]
Most helpful comment
@rostopira For Swift you need to add
rawValuetoOSNotificationDisplayType.none.