First - Thank you for all that you do for the community by providing this library and the Parse services for us!
While performing testing on iOS10 I've encountered some unexpected behavior with the PFAnonymousUtils isLinkedWithUser: method returning false when the user actually is anonymous. My app has been successfully using this API since iOS7 in production for over 1.5 years and this is the first time I've encountered an issue with it.
The first time I install and launch my app, [PFAnonymousUtils isLinkedWithUser:[PFUser currentUser]] accurately returns YES and everything works as expected.
Printing out the PFUser object and [PFAnonymousUtils isLinkedWithUser:[PFUser currentUser]] value:
2016-09-08 08:04:12.075 [47508:23444393] +[ParseHelper userIsAnonymous](0x11030c7f0)(Line:133)[T<NSThread: 0x610000069d80>{number = 1, name = main}] [PFUser currentUser] >> <PFUser: 0x6100000eaf80, objectId: jDRGrpD0OR, localId: (null)> {
RunCount = 1;
appVersion = "1.3.4 (46)";
username = sHt3QdyQ2liM7Olk2AkcwsDKt;
}
(lldb) po [PFAnonymousUtils isLinkedWithUser:[PFUser currentUser]]
0x0000000000000001
However, the second (and subsequent) time that I launch the application, [PFAnonymousUtils isLinkedWithUser:[PFUser currentUser]] returns nil which ends up resulting in a false value when the user actually is anonymous:
2016-09-08 08:05:17.505 [47542:23446822] +[ParseHelper userIsAnonymous](0x1056e57f0)(Line:133)[T<NSThread: 0x60800007f7c0>{number = 1, name = main}] [PFUser currentUser] >> <PFUser: 0x6180000fd500, objectId: jDRGrpD0OR, localId: (null)> {
RunCount = 2;
appVersion = "1.3.4 (46)";
username = sHt3QdyQ2liM7Olk2AkcwsDKt;
}
(llbd) po [PFAnonymousUtils isLinkedWithUser:[PFUser currentUser]]
nil
Is this a known bug in the API for iOS 10? To my knowledge my dependencies are all up to date via Cocoapods:
- Bolts (1.8.0):
- Bolts/Tasks (1.8.0)
- Parse (1.14.2):
- Bolts/Tasks (~> 1.8)
- ParseFacebookUtils (1.10.0):
- Bolts/Tasks (~> 1.5)
- Parse (~> 1.9)
- ParseTwitterUtils (1.11.0):
- Bolts/Tasks (~> 1.7)
- Parse (~> 1.13)
- ParseUI (1.2.0):
- Bolts/Tasks (~> 1.3)
- Parse (~> 1.9)
Would greatly appreciate any help you could provide so I can wrap up iOS 10 support in time for its release.
Thank you! Derek
I have the same issue, albeit showing in a different manner. When I launch my app and log in, everything works. Quitting the simulator and launching again, problems arise. I've narrowed it down to X-Parse-Session-Token not being set in the header - seems like the user session isn't persisted between launches on iOS 10.
Edit: Looks like it's a bug in the simulator - testing on my iPhone 6 Plus doesn't show any problems. @derekleeapp, can you confirm this only happens in the simulator, or do you have the issue running on your device also?
@madsb Thanks for your comment! I've been trying to dig into this myself and I'm also seeing that the user session does not seem to be persisted in subsequent launches - or maybe it's that some of the user session details cannot be read from disk.
The 'linkedServiceNames' NSMutableSet (on PFUser) does not appear to be loaded properly on subsequent launches. I'm trying to see if I can uncover additional details and will update if I find anything.
@derekleeapp: Did you see my edit? Can you confirm this is also happening on your device, or should we put it down as a simulator bug?
@madsb I hadn't seen your edit - thank you for the tip! Let me try this on a device as I've only been working in the simulator thus far - will give this a shot on a device later (do not have one on me now).
@madsb I've been testing on a device today and thankfully I am not seeing this behavior. This does look like it only applies to the simulator (but I only have a single iOS 10 device to test on).
Given that this is seems to be only a bug with the simulator I'm not sure what the best way would be to report this as I haven't identified exactly where the issue is (though I think I've narrowed it does to either the persistence of the user object to disk or reading the user object from disk). Would you have any suggestions on where it would be best to report this?
Heureka, I actually think I found the solution for this. Looks like we need to enable Keychain Sharing in the Capabilities tab for Facebook login to work now (and for the session token to persist between sessions). Check out a more detailed SO answer here: http://stackoverflow.com/a/38799196/696868
Thanks for this tip @madsb! I took a look at it and I feel like Keychain Sharing shouldn't be necessary just for a single app, but I couldn't find a lot of information about it to be honest.
I did however find the following Radar that someone else opened which says that the Keychain cannot be accessed from the Xcode 8 / iOS 10 simulator unless Keychain Sharing is enabled, so I'm thinking that this may actually be an issue on Apple's side.
@derekleeapp @madsb: quite happy I found out you guys where having the same issue. I've been looking into this for 2 days now. I was wondering if there are any updates on this topic.
Hi @kgoedecke - It's my understanding that this is just a bug with the iOS 10 / Xcode 8 simulator as per the open radar link I posted above. I haven't checked the latest beta yet to see if this is resolved since everything seems to be working OK on the device but on OpenRadar at least this is still open.
Hi, even the radar is still open, I can confirm this is now working correctly with iOS Simulator 10.2.
This issue has been automatically marked as stale because it has not had recent activity. If you believe it should stay open, please let us know! As always, we encourage contributions, check out the Contributing Guide