[Bug]: Swift/SwiftNativeNSArray.swift:77: Fatal error: Array index out of range after update to 3.20
What happened?
After update to Version 3.2.0 the app crashes. If you need further information please let me know how to assist
Error happens here on fallBackToSettings - something with arguments 0... Fatal error: Array index out of range
- (void)promptForPushNotificationsWithUserResponse:(CDVInvokedUrlCommand*)command {
promptForPushNotificationsWithUserResponseCallbackId = command.callbackId;
[OneSignal promptForPushNotificationsWithUserResponse:^(BOOL accepted) {
successCallbackBoolean(promptForPushNotificationsWithUserResponseCallbackId, accepted);
} fallbackToSettings:[command.arguments[0] boolValue]];
}
To Native Cordova -> OneSignalPush setNotificationOpenedHandler OneSignalPush1826542041 ["options": []]
2022-11-30 12:12:26.306089+0100 app[82443:307430] VERBOSE: Notification opened handler set successfully
To Native Cordova -> OneSignalPush promptForPushNotificationsWithUserResponse OneSignalPush1826542042 ["options": []]
Swift/SwiftNativeNSArray.swift:77: Fatal error: Array index out of range
2022-11-30 12:12:26.306340+0100 app[82443:307430] Swift/SwiftNativeNSArray.swift:77: Fatal error: Array index out of range
2022-11-30 12:12:28.332229+0100 app[82443:309858] VERBOSE: network response (OSRequestGetIosParams): {
outcomes = {
direct = {
enabled = 0;
};
indirect = {
enabled = 0;
"notification_attribution" = {
limit = 10;
"minutes_since_displayed" = 60;
};
};
unattributed = {
enabled = 0;
};
};
"receive_receipts_enable" = 1;
"uses_provisional_auth" = 0;
}
2022-11-30 12:12:28.332753+0100 app[82443:309858] DEBUG: App ID: c56508ab-4c7e-4af0-8670-436ac021f16c, external ID: userid:157
2022-11-30 12:12:28.332933+0100 app[82443:309859] VERBOSE: HTTP Request (OSRequestUpdateExternalUserId) with URL: https://api.onesignal.com/players/54f4887e-7d64-4cdb-ad4d-2a6cc7540509, with parameters: {
"app_id" : "c56508ab-4c7e-4af0-8670-436ac021f16c",
"external_user_id" : "userid:157"
}
(lldb)
Steps to reproduce?
1) Update capacitor plugin to
"onesignal-cordova-plugin": "3.2.0"
2) Not sure yet what exactly triggers it
What did you expect to happen?
The app not crashing...
OneSignal Cordova SDK version
Release 3.2.0
Which platform(s) are affected?
- [X] iOS
- [ ] Android
Relevant log output
o Native Cordova -> OneSignalPush setLogLevel OneSignalPush609457804 ["options": [6, 0]]
To Native Cordova -> OneSignalPush init OneSignalPush609457805 ["options": [c56508ab-4c7e-4af0-8670-436ac021f16c]]
2022-11-30 12:25:34.398855+0100 app[83817:319504] VERBOSE: setAppId(id) called with appId: c56508ab-4c7e-4af0-8670-436ac021f16c!
2022-11-30 12:25:34.398914+0100 app[83817:319504] VERBOSE: setAppId(id) finished, checking if launchOptions has been set before proceeding...!
2022-11-30 12:25:34.398973+0100 app[83817:319504] VERBOSE: setAppId(id) successful and launchOptions are set, initializing OneSignal...
2022-11-30 12:25:34.400243+0100 app[83817:319504] DEBUG: Downloading iOS parameters for this application
2022-11-30 12:25:34.400700+0100 app[83817:319504] VERBOSE: registerForPushNotifications Called:waitingForApnsResponse: 1
2022-11-30 12:25:34.401012+0100 app[83817:319821] VERBOSE: registerUser:waitingForApnsResponse: 1
2022-11-30 12:25:34.401182+0100 app[83817:319821] VERBOSE: registerUser:initializationTime: 2022-11-30 11:25:34 +0000
2022-11-30 12:25:34.401673+0100 app[83817:319821] VERBOSE: registerUserAfterDelay
2022-11-30 12:25:34.405227+0100 app[83817:319504] VERBOSE: registering for Application Lifecycle notifications
2022-11-30 12:25:34.405333+0100 app[83817:319504] VERBOSE: setLaunchOptions() called with launchOptions: (null)!
2022-11-30 12:25:34.405406+0100 app[83817:319504] VERBOSE: setLaunchOptions(id) finished, checking if appId has been set before proceeding...!
2022-11-30 12:25:34.405464+0100 app[83817:319504] VERBOSE: setLaunchOptions(launchOptions) successful and appId is set, initializing OneSignal...
2022-11-30 12:25:34.407232+0100 app[83817:319504] VERBOSE: registerForPushNotifications Called:waitingForApnsResponse: 1
2022-11-30 12:25:34.407401+0100 app[83817:319819] VERBOSE: registerUser:waitingForApnsResponse: 1
To Native Cordova -> OneSignalPush setExternalUserId OneSignalPush609457806 2022-11-30 12:25:34.407489+0100 app[83817:319819] VERBOSE: registerUser:initializationTime: 2022-11-30 11:25:34 +0000
["options": [userid:157]]
⚡️ [log] - this.userId 157
2022-11-30 12:25:34.407569+0100 app[83817:319819] VERBOSE: registerUserAfterDelay
To Native Cordova -> OneSignalPush sendTags OneSignalPush609457807 ["options": [{
role = investor;
}]]
To Native Cordova -> OneSignalPush setNotificationOpenedHandler OneSignalPush609457808 ["options": []]
2022-11-30 12:25:34.407826+0100 app[83817:319504] VERBOSE: Notification opened handler set successfully
To Native Cordova -> OneSignalPush promptForPushNotificationsWithUserResponse OneSignalPush609457809 ["options": []]
Swift/SwiftNativeNSArray.swift:77: Fatal error: Array index out of range
2022-11-30 12:25:34.408169+0100 app[83817:319504] Swift/SwiftNativeNSArray.swift:77: Fatal error: Array index out of range
(lldb)
Code of Conduct
- [X] I agree to follow this project's Code of Conduct
Some additional information i found by trying different versions below. Were there any breaking changes between 3.01 and 3.1.0? I was checking release notes and haven't found any information yet...
[email protected] broken
[email protected] broken
onesignal-[[email protected].] broken
[email protected] works
I'm getting the same issue, any updates on it?
Have the same problem also with version 3.3.0.
Are there any updates?
I have the same issue on 3.0.4 Any ideas?
I think you have to use the last version of capacitor. for me - i tried a lot of things and all of a sudden it worked...
I downgraded to 3.0.1 to make it work.