|
71 | 71 |
|
72 | 72 | @implementation OneSignal
|
73 | 73 |
|
74 |
| -NSString* const ONESIGNAL_VERSION = @"020101"; |
| 74 | +NSString* const ONESIGNAL_VERSION = @"020102"; |
75 | 75 | static NSString* mSDKType = @"native";
|
76 | 76 | static BOOL coldStartFromTapOnNotification = NO;
|
77 | 77 | static BOOL registeredWithApple = NO; //Has attempted to register for push notifications with Apple.
|
@@ -186,6 +186,11 @@ + (id)initWithLaunchOptions:(NSDictionary*)launchOptions appId:(NSString*)appId
|
186 | 186 | else if ([[UIApplication sharedApplication] respondsToSelector:@selector(registerForRemoteNotifications)])
|
187 | 187 | [[UIApplication sharedApplication] registerForRemoteNotifications];
|
188 | 188 |
|
| 189 | + if (mUserId != nil) |
| 190 | + [self registerUser]; |
| 191 | + else // Fall back incase Apple does not responsed in time. |
| 192 | + [self performSelector:@selector(registerUser) withObject:nil afterDelay:30.0f]; |
| 193 | + |
189 | 194 | [OneSignalTracker onFocus:NO];
|
190 | 195 | }
|
191 | 196 |
|
@@ -506,12 +511,12 @@ + (void)updateDeviceToken:(NSString*)deviceToken onSuccess:(OSResultSuccessBlock
|
506 | 511 | tokenUpdateSuccessBlock = successBlock;
|
507 | 512 | tokenUpdateFailureBlock = failureBlock;
|
508 | 513 |
|
509 |
| - // iOS 8 - We get a token right away but give the user 10 sec to responsed to the system prompt. |
| 514 | + // iOS 8 - We get a token right away but give the user 30 sec to responsed to the system prompt. |
510 | 515 | // Also check mNotificationTypes so there is no waiting if user has already answered the system prompt.
|
511 | 516 | // The goal is to only have 1 server call.
|
512 | 517 | if ([OneSignalHelper isCapableOfGettingNotificationTypes] && mNotificationTypes == -1) {
|
513 | 518 | [NSObject cancelPreviousPerformRequestsWithTarget:self selector:@selector(registerUser) object:nil];
|
514 |
| - [self performSelector:@selector(registerUser) withObject:nil afterDelay:10.0f]; |
| 519 | + [self performSelector:@selector(registerUser) withObject:nil afterDelay:30.0f]; |
515 | 520 | }
|
516 | 521 | else
|
517 | 522 | [OneSignal registerUser];
|
|
0 commit comments