Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-17714] iOS8: registerForPushNotifications events do not fire, no token returned

GitHub Issuen/a
TypeBug
PriorityCritical
StatusClosed
ResolutionCannot Reproduce
Resolution Date2014-09-17T17:08:18.000+0000
Affected Version/sRelease 3.4.0
Fix Version/sn/a
ComponentsiOS
Labelsios8
ReporterJason Kneen
AssigneeJon Alter
Created2014-09-17T13:01:01.000+0000
Updated2015-05-25T22:05:29.000+0000

Description

Running latest RC of 3.4 + 3.4.0.v20140916181713 SDK and XCode6 Building with iOS8SDK with the following code:-
Ti.Network.registerForPushNotifications({
		types : [Ti.App.iOS.NOTIFICATION_TYPE_BADGE, Ti.App.iOS.NOTIFICATION_TYPE_ALERT, Ti.App.iOS.NOTIFICATION_TYPE_SOUND],
		success : onSuccess,
		error : deviceTokenError,
		callback : receivePush
	});
works and onSuccess is fired, a token is received - but the error :- "Passing types to registerForPushNotifications is not supported on iOS 8 and greater. Use registerUserNotificationSettings to register notification types." is reported in the logs If I use the recommended approach in the docs:-
Ti.App.iOS.registerUserNotificationSettings({
		types : [Ti.App.iOS.NOTIFICATION_TYPE_BADGE, Ti.App.iOS.NOTIFICATION_TYPE_ALERT, Ti.App.iOS.NOTIFICATION_TYPE_SOUND],
	});

	Ti.Network.registerForPushNotifications({
		success : onSuccess,
		error : deviceTokenError,
		callback : receivePush
	});
onSuccess is not called, no token received, push is not registered.

Comments

  1. Ingo Muschenetz 2014-09-17

    [~wluu] FYI. Can you investigate as well?
  2. Ingo Muschenetz 2014-09-17

    Notes:

    client built their own

    so I'm just doing registerForPushNotifications which I guess goes to Apple

    and get the device token

    then fire the client's API to give them the token

    been working fine in iOS7 and iOS8 if I use the old methods

    If I change to the new way, doesn't work

  3. Jon Alter 2014-09-17

    [~jkneen] in iOS 8 registerForPushNotifications will not be successful if user notifications for that app are not enabled. 1. Go to Settings>Notifications>Your App and make sure that notifications are enabled 2. When registering, make sure that you only call registerForPushNotifications after the user has opted to allow notifications from your app. This can be done by waiting for the usernotificationsettings event to fire before calling registerForPushNotifications. There is an example of this in the [ti.cloud example app](https://github.com/appcelerator-modules/ti.cloud/commit/e6c4b8b06806b1d16692f1b53bdf9f03375e7b08#diff-21e2d89e72434de8cdfd659ae14b9ae2R61).
  4. Jason Kneen 2014-09-17

    Is all this + examples in the docs? Doesn't seem like the release notes cover all this.
  5. Jason Kneen 2014-09-17

    Some really odd behaviour has been observed. I've got it working but here's what happened:- 1. Using the code example from above, I'm doing the registernotification call and capturing the usernotificationsettings event, then calling registerForPush etc. 2. This didn't work. No notifications entry was created on the phone, registerForPushNotifications never responds. 3. I changed my code back to put types BACK into the registerForPushNotifications call (which I know I shouldn't need on iOS8) 4. Reinstalling to device, and running the code, the app appeared in the settings > notifications section *however* it was off 5. I turned it back on, reverted the code to NOT include the types in the RFP call, and it all worked fine. The odd thing is, this app was previously authorised on the device, and in the normal notifications settings - it had been authorised prior to the iOS8 upgrade, so not sure if that did something. The only issue now is the docs don't reflect this process as I've done it. It's not clear you have to trap the event, chain the two together.
  6. Jon Alter 2014-09-17

    Docs are being updated. Resolving.
  7. Timan Rebel 2014-09-18

    I currently have the same issue. On iOS8 and with 3.4.0RC (and also with nightly build), somehow the types are not registered with Apple. Reinstalling does not help and the workaround from [~jkneen] neither. No way I can get the types registered with Apple. Because types is not registered, there is also no 'Notifications' page in App Settings en can not dis- and enable them. I will keep investigating and if I find a cause, I will report it here. But note that Jason and Ingo are not the only ones having this issue.
  8. Timan Rebel 2014-09-18

    I found the cause of [~jkneen]'s original issue and mine as well. The types have been renamed from Ti.App.iOS.NOTIFICATION* to Ti.App.iOS.USER_NOTIFICATION*
  9. Chad Stachowicz 2015-05-25

    What is the fix to this, this is happening to my on iOS8 and it worked fine on appcelerator 3.3 and iOS7? Is it just expected push notification will never work again on iOS? Should we be looking at other platforms if we want to use push? Please help, this complaint is all over the google and jira...
  10. Chad Stachowicz 2015-05-25

JSON Source