- Home /
Solved by myself
Problem in Register for remote notifications
Hi Guys,
I am trying below code, but its not working, what I am doing wrong?
var tokenSent = false;
function Start() {
NotificationServices.RegisterForRemoteNotificationTypes(RemoteNotificationType.Alert |
RemoteNotificationType.Badge |
RemoteNotificationType.Sound);
}
function Update () {
if (!tokenSent) {
var token : byte[] = NotificationServices.deviceToken;
if (token != null) {
Debug.Log("Registered!")
tokenSent = true;
}
}
}
I simply take a new scene and put this script on main camera, change the bundle identifier and Build and Run(CMD+B).
XCode console never print the message "Registered!", please let me know where I am doing wrong, I guess that, there is any mistake in provision profile. May be two or more app installed with same provision, therefore its creating problem???
Waiting for your replies.
Did you properly configure your app for push notifications in the Provisioning Portal? There's a throrough guide here: http://www.raywenderlich.com/32960/apple-push-notification-services-in-ios-6-tutorial-part-1
@mattssonon : yes I have configured it properly, I marked as push notification enabled and also create "Development SSL Certificate".
when I was used this provision profile with PushWoosh then it was working fine,
Thanks!
The last time I tried using Debug Log in iOS, the XCode console would not show any statements from Unity. I.e. Unity Debug.Log no longer goes to the console. It may be you have to select Development Build or they may have fixed it since then. I created an Objective C method that calls NSLog for my logs and pipe all logs through that now. $$anonymous$$y point is are you sure that code isn't being reached?