Description:
While trying our app on iOS 13 Beta 2, I noticed that OneSignal does not work. We are initializing the SDK in "didFinishLaunchingWithOptions", and after that the following log gets printed:
2019-06-21 12:57:28.039669+0200 OurApp[575:45514] ERROR: Encountered error during push registration with OneSignal: Error Domain=OneSignalError Code=400 "(null)" UserInfo={returned={
errors = (
"["Identifier invalid format."]"
);
success = 0;
}}
2019-06-21 12:57:28.039767+0200 OurApp[575:45514] ERROR: Encountered error during email registration with OneSignal: (null)
2019-06-21 12:57:57.759309+0200 OurApp[575:45514] ERROR: Encountered error during push registration with OneSignal: Error Domain=OneSignalError Code=400 "(null)" UserInfo={returned={
errors = (
"["Identifier invalid format."]"
);
success = 0;
}}
Environment
Steps to Reproduce Issue:
Anything else:
The app does not crash, it simply does not register with OneSignal. Above log messages get repeated after some time, probably the SDK re-trying to register
After turning on verbose logging for the OneSignal SDK, I've noticed the following difference:
On iOS 12.2, the following is sent in OSRequestRegisterUser:
...
"identifier": "5c868...............40cdb"
...
while on iOS 13 the following is sent:
...
"identifier": "{length=32,bytes=0x5c868...............40cdb}"
...
I'm also having the same issue.
Thank you for bringing this up. Because iOS 13 is still in Beta, this issue may be resolved before the release this fall. However, we will keep a close eye on this leading up to the release. Thanks again
According to https://forums.developer.apple.com/thread/117545, the issue might be caused by incorrectly using the [NSData description] method to convert the identifier to a String, and the correct way would be to format the bytes into the desired form, as explained in the example by vasyl.liutikov (or at the link he provides to facebook sdk: https://github.com/facebook/facebook-objc-sdk/blob/37bb3901a65d9f229171c25ed8db0297dc171f76/FBSDKCoreKit/FBSDKCoreKit/Internal/FBSDKInternalUtility.m#L521 )
@henning-cg ,
Thanks for the details. We will look further into this in order to fix in a coming release.
Is that possible to show errors more obviously? For me, it took me for a long time until I found the error message on the console. Why not just crashing the app at least in Debug mode?
let trimmedDeviceToken = [[inDeviceToken description] stringByTrimmingCharactersInSet:[NSCharacterSet characterSetWithCharactersInString:@"<>"]];
line 2091 of OneSignal.m
probably here.
Same here in iOS 13 Beta 3. In ids callback, payload has pushToken which goes like {length=32,...} instead of the bytes, probably causing everything to mess up and making userId null.
Since we, developers, are already testing for iOS 13 (that's why beta program is for), I think this needs to be addressed with high priority.
We're running into this as well and would appreciate a quick turnaround.
Yup, @owenzhao is right. It's that line. I've made a _temporary_ fix:
ANY CHANGES DONE MAY BE PURGED WHEN PACKAGES FROM COCOAPODS/CARTHAGE/NPM/YARN ETC. ARE UPDATED
I've taken this answer and pasted somewhere at top into OneSignal.m (make sure to paste it in an empty place, _not_ inside an @implementation or @interface block:
@implementation NSData (NSData_Conversion)
#pragma mark - String Conversion
- (NSString *)hexadecimalString {
/* Returns hexadecimal string of NSData. Empty string if data is empty. */
const unsigned char *dataBuffer = (const unsigned char *)[self bytes];
if (!dataBuffer)
return [NSString string];
NSUInteger dataLength = [self length];
NSMutableString *hexString = [NSMutableString stringWithCapacity:(dataLength * 2)];
for (int i = 0; i < dataLength; ++i)
[hexString appendString:[NSString stringWithFormat:@"%02lx", (unsigned long)dataBuffer[i]]];
return [NSString stringWithString:hexString];
}
@end
Then, inside OneSignal class, change didRegisterForRemoteNotifications:(UIApplication*)app deviceToken:(NSData*)inDeviceToken method as follows:
+ (void)didRegisterForRemoteNotifications:(UIApplication*)app deviceToken:(NSData*)inDeviceToken {
if ([OneSignal shouldLogMissingPrivacyConsentErrorWithMethodName:nil])
return;
let parsedDeviceToken = [inDeviceToken hexadecimalString];
[OneSignal onesignal_Log:ONE_S_LL_INFO message: [NSString stringWithFormat:@"Device Registered with Apple: %@", [inDeviceToken hexadecimalString]]];
waitingForApnsResponse = false;
if (!app_id)
return;
[OneSignal updateDeviceToken:parsedDeviceToken onSuccess:^(NSDictionary* results) {
[OneSignal onesignal_Log:ONE_S_LL_INFO message:[NSString stringWithFormat: @"Device Registered with OneSignal: %@", self.currentSubscriptionState.userId]];
} onFailure:^(NSError* error) {
[OneSignal onesignal_Log:ONE_S_LL_ERROR message:[NSString stringWithFormat: @"Error in OneSignal Registration: %@", error]];
}];
}
If you're just referencing OneSignal as a subproject/side project you don't need to do anything, you're ready.
If you are statically linking or using a package manager (e.g. CocoaPods, Carthage, or yarn/npm if on React Native like me): Archive and export the library, find libOneSignal.a file in the output (tip: it's in node_modules for React Native), and replace it with yours, and voila, you've got OneSignal again.
I haven't tested this in pre-iOS 13 as I only have an iOS 13 device, but it _should_ work. It works on iPhone X, iOS 13 Developer Beta 3 in my React Native app as of speaking (though it should work on regular iOS apps since I haven't touched React Native or React Native bridge project and I've only touched the native iOS project).
Again, use this for development until the library is officially updated, then go back to using the original library.
@canpoyrazoglu do you know how to improve this for cocoapods?
@janczakb I haven't spent time for forking the repo and changing the dependencies as this is a temporary solution just for developer testing, so just open the project from the pods, change the code, build it, and it should work until you regenerate/reinstall the pods for whatever reason. To be sure you can check the last modified date of the pod library/framework for the OneSignal project.
Just wanted to say that I am currently testing on beta 4 and the same issue exists.
I have the same issue
I'm having the same issue using the iOS 13 Beta 4.
I’ll create a PR for this tomorrow if no one beats me to the punch ;)
@Nightsd01 ,
Thanks!
When will this be fixed for iOS 13 users?
Wanted to jump back in here and say that I am using my app on iOS 13 and it seems to work fine-ish? There are still errors and such but I do register for notifications and can receive them which I did not expect. I'm currently on beta 5
Created a PR to fix this (#509)
this is still not working on beta 5
this is still not working on beta 5
As the PR has not been accepted. We need the new release on cocoapods.
PR has been accepted and merged in, we will be creating a new release soon. I'll update this thread once released.
@jkasten2 When will the next build be released?
We just released 2.10.1 with this fix.
https://github.com/OneSignal/OneSignal-iOS-SDK/releases/tag/2.10.1
@jkasten2 Did the fix make it into the Unity sdk as well? I'm still seeing the error with ios 13.1 beta 2 and xcode beta 7.
@NumaNumaNuma ,
Yes. https://github.com/OneSignal/OneSignal-Unity-SDK/releases/tag/2.8.2
Ok thanks 👍
I am still getting this error when using OneSignal iOS SDK version 2.11.1 on iOS 13.1. This may be caused by the Xcode 11 compiler.
Upon calling this code below:
OneSignal.getPermissionSubscriptionState().subscriptionStatus.userId
It is always returning an empty string even though I have given permission for push notification.
I am also getting this exact same error when I run it on iOS 13.1.
ERROR: Encountered error during push registration with OneSignal: Error Domain=OneSignalError Code=400 "(null)" UserInfo={returned={
errors = (
"[\"Identifier invalid format.\"]"
);
success = 0;
}}
Am I missing something? Is there anything that I should update? At this time of writing OneSignal iOS SDK version 2.11.1 is the latest release.
The latest SDK is 2.11.1. I am using it against iOS 13.1 with Xcode 11.1 GM. No issue so far. Did you try to remove Xcode derived folder and build again first?
Zhao Xin
在 2019年9月27日,下午2:51,Trevin Wisaksana notifications@github.com 写道:
I am still getting this error when using OneSignal iOS SDK version 2.11.0 on iOS 13.1. This maybe caused because of the Xcode 11 compiler.Upon calling this code below:
OneSignal.getPermissionSubscriptionState().subscriptionStatus.userId It is always giving me an empty string even though I have given permission for push notification.I am also getting this exact same error when I run it on iOS 13.1.
ERROR: Encountered error during push registration with OneSignal: Error Domain=OneSignalError Code=400 "(null)" UserInfo={returned={ errors = ( "["Identifier invalid format."]" ); success = 0; }}
Am I missing something? Is there anything that I should update? At this time of writing OneSignal iOS SDK version 2.11.0 is the latest release.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.
I tried it just now and it's still not working. The biggest different between what we did is I am using Xcode 11 and you're using Xcode 11.1 GM. Theoretically, this shouldn't affect it. But I guess this should be put to the test.
I tried it just now and it's still not working. The biggest different between what we did is I am using Xcode 11 and you're using Xcode 11.1 GM. Theoretically, this shouldn't affect it. But I guess this should be put to the test.
I don't think so. I had been using Xcode 11 betas, GM and GM 2 for quite a while. As Xcode 11.1 GM came suddenly without any prior betas two days ago.
I have not encounter this issue ever since " 2.10.1" released on Aug 2.
I see. But what other issues could trigger this error message?
ERROR: Encountered error during push registration with OneSignal: Error Domain=OneSignalError Code=400 "(null)" UserInfo={returned={ errors = ( "[\"Identifier invalid format.\"]" ); success = 0; }}
I ran the same code on iOS 12 and it works normally. But for iPad OS and iOS 13 it suddenly stops working.
I’m always seeing this error in Xcode but in production people are registered properly. I’m pretty sure you can disregard it. It could be because of a dev/production certificates mismatch. If possible, it’ would be worth testing by releasing your app, watching your one signal dashboard and checking new people are being added. The dashboard displays the app BUILD number (not version number for some reason!) so you can set that to 99 or whatever in Xcode and check your new app is working ok.
Thanks for bringing this up. After we tested it on Test Flight, it works! I don't know if it's just us but testing it by installing the app directly from Xcode doesn't work for devices using iOS 13.
But anyways, it solved our problem 😃
Ha, amazing :)
testing it by installing the app directly from Xcode doesn't work for devices using iOS 13.
Yup I ran into this issue as well. I don't see my device show up on the OneSignal dashboard.
I was facing this same problem and was a iOS13 issue. (On iOS12 there is no problem)
The fix is simple and is update the onesignal iOS SDK to "onesignal-cordova-plugin": "^2.6.0",
if you are using ionic open a terminal window then go to your Ionic project folder then
cordova plugin remove onesignal-cordova-plugin
cordova plugin add onesignal-cordova-plugin
The version of the One signal iOS SDK on Xcode must appear '2.11.0'
(You can see this on Pods -> Podfile
For React Native 0.61.1
Go to your project folder and upgrade module
yarn upgrade react-native-onesignal
Make sure its linked
react-native link react-native-onesignal
Go into the iOS folder and update your Pods
cd ios
pod update react-native-onesignal
@asccort
After update cordova plugin version, should run
cd platform/ios && pod install to update pod dependency also is important clear build folder before
run or archive
Please replace your one signal pod version from pod 'OneSignal', '>= 2.6.2', '< 3.0' to pod 'OneSignal', '>= 2.11.2', '< 3.0'
@NupendraVerma
Thanks, it's working.
This is showing up in my debugger log,
UserInfo={returned={
errors = (
"[\"Identifier invalid format.\"]"
);
success = 0;
}}
problem: I was version locked to 2.5.1.
fix: as suggested above
pod 'OneSignal', '>= 2.11.2', '< 3.0'
pod 'OneSignal', '>= 2.11.2', '< 3.0'
This is give me error like this
[!] Invalid Podfile file: syntax error, unexpected tIDENTIFIER, expecting end
// pod 'OneSignal'
^~~
: syntax error, unexpected end, expecting end-of-input.
I get this error in log, using onesignal 2.9.0,
ERROR: Encountered error during push registration with OneSignal: Error Domain=OneSignalError Code=400 "(null)" UserInfo={returned={
errors = (
"[\"Identifier invalid format.\"]"
);
success = 0;
}}
My podfile is this
pod 'OneSignal', '>= 2.11.2', '< 3.0'
@priyankastridhyatech Maybe you're missing an 'end' statement in your podfile?
Okay so I found the issue for me, so in my app initialization i used:
this.oneSignal.startInit(environment.ONESIGNAL_APP_ID, ' ');
But the issue was actually a null string, meaning that the app was not successfully importing the variable "environment.ONESIGNAL_APP_ID".
I fixed that by simply hardcoding the App ID in the actual "OneSignalPush.m" file... It's not good practice but it stops the app from crashing.
I fixed that by simply hardcoding the App ID in the actual "OneSignalPush.m" file... It's not good practice but it stops the app from crashing.
I'm stuck on this, can you show me where to hardcode it? @AhrenFullStop
I tried with line 95 in OneSignalPush.m - I deleted this line:
NSString* appIdStr = (appId ? [NSString stringWithUTF8String: appId] : nil);
and I inserted this:
NSSting* appIdStr = @"XXXXX-XXXXX-XXXX-XXXXX";
But it doesn't solve my problem.
Edit: I finally got it work, using version 2.10.1 of the plugin, which fixes the identifier bug and still works with non-wkwebview (removed in 2.10.2).
Most helpful comment
I was facing this same problem and was a iOS13 issue. (On iOS12 there is no problem)
The fix is simple and is update the onesignal iOS SDK to "onesignal-cordova-plugin": "^2.6.0",
if you are using ionic open a terminal window then go to your Ionic project folder then
cordova plugin remove onesignal-cordova-plugin
cordova plugin add onesignal-cordova-plugin
The version of the One signal iOS SDK on Xcode must appear '2.11.0'
(You can see this on Pods -> Podfile