Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
1
Question by turnipinrut · Aug 19, 2015 at 08:17 AM · iospluginxcodepushnotification

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

Comment
Add comment · Show 3
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Voxel-Busters · Aug 19, 2015 at 11:40 AM 0
Share

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.

avatar image turnipinrut · Aug 19, 2015 at 12:08 PM 0
Share

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

avatar image Voxel-Busters · Aug 19, 2015 at 12:14 PM 0
Share

{ 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.

2 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by Numa · Sep 24, 2017 at 11:45 AM

Did you ever find a way around this?

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

Answer by matiasreparaz · Dec 18, 2017 at 07:19 PM

Same problem here! Any answer???,Same problem here.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

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


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges