drallgood / jpasskit

jPasskit is an Java™ implementation of the Apple™ PassKit Web Service.
Apache License 2.0
275 stars 109 forks source link

iOS 9 UserInfo is NSDictionary #62

Closed woolfel closed 8 years ago

woolfel commented 8 years ago

It appears in iOS9 userInfo is now NSDictionary. When you try to open a pass in another app, it throws an error.

https://developer.apple.com/library/ios/documentation/PassKit/Reference/PKPass_Ref/index.html#//apple_ref/occ/instp/PKPass/userInfo Objective-C

@property(nonatomic, copy, readonly) NSDictionary *userInfo

drallgood commented 8 years ago

yes?

woolfel commented 8 years ago

looking at apple's docs, it doesn't say if the previous release had it as a string. Do you know?

drallgood commented 8 years ago

Well.. that's the passkit framework. That one isn't as relevant for jPasskit.

If you look here, it just tells you "any JSON data" which I interpreted as String:

https://developer.apple.com/library/ios/documentation/UserExperience/Reference/PassKit_Bundle/Chapters/TopLevel.html#//apple_ref/doc/uid/TP40012026-CH2-SW1

woolfel commented 8 years ago

thanks for the link. The error my co-worker is getting in iOS is this:

Invalid data error reading pass pass.com.mydomain/123456789. Value for key 'userInfo' must be of class NSDictionary, but is actually of class __NSCFString

So what is the solution? I can change userInfo to use java Map instead of String, but it's not clear to me what the correct fix is.

thanks

drallgood commented 8 years ago

to be honest, I haven't tried to use that key.

You could serialize your Map to a string and store it, but that might or might not work...

I've changed the code to use a map instead. Can you please give that a try?

woolfel commented 8 years ago

great thanks. I will try it tomorrow and report back.

woolfel commented 8 years ago

The change is working for us. Going to close the ticket, thanks!