- Home /
iOS.RemoteNotification userInfo empty
Hi Guys
I am having trouble reading the data passed by a remote notification.
It should be simple, and the steps seem clear, but the dictionary is empty.
userInfo.count returns 0.
trying to loop through or foreach through the userInfo dictionary also returns no information.
userInfo should contain the complete payload of the pushnotification
in xcode you can open the file “UnityAppController.mm”
in this file you see the method: “- (void)application:(UIApplication*)application didReceiveRemoteNotification:(NSDictionary*)userInfo”
you can add:
NSLog(@“user info: %@”, userInfo);
this will return
user info: { "aps" : { "alert" : { "loc-args" : [ "Local Team 1", "Visitor Team" ], "body" : "Test", "loc-key" : "" }, "action" : "reward", "data" : { "token" : "", "eventData" : "" }, "name" : "reward", "type" : "reward", "message" : "" } }
So i know that the info is there
But that info does not seem to make it into unity!?
any advice would be great
thanks
Rich
you need to include user info dictionary with in the dictionary you got. RemoteNotification.userinfo looks for dictionary with in above mentioned payload.
Its a bit confusing because, you named payload as user info and unity's userinfo is a value with in the payload.
Hi Voxel, thanks for your reply.
I'm still a bit confused though.
I get a RemoteNotification and within that class there is a Dictionary named userInfo.
See here in the documentation http://docs.unity3d.com/ScriptReference/iOS.RemoteNotification.html
There is no other Dictionary involved, or am i missing something?
it is that Dictionary that is returning empty.
Thanks
{ aps { alert : "Alert message"; .... .... }
user-info : {key1 = value1, key2 = value2} }
This is how a custom pay load can be. The whole data is payload (in your case you made it as userInfo NSDictionary). Once received unity sends the payload to ints internal parsing and get the required values of RemoteNatificaiton class memeber variables.
I need to mention that, what key unity considers to take as custom payload(to fill userInfo variable of RemoteNotification), i'm not aware as its not documented anywhere.
Answer by matiasreparaz · Dec 18, 2017 at 07:19 PM
Same problem here! Any answer???,Same problem here.
Your answer
Follow this Question
Related Questions
Linker errors on Xcode 4.5.2 with OpenCV 2.4.3 2 Answers
Unity NotificationServices 1 Answer
iOS build is including Mac OSX .bundle files into Xcode Project 2 Answers
iOS - Disable ARC on XCode Projects 2 Answers
Call Unity class in XCode 1 Answer