Simplicity icon indicating copy to clipboard operation
Simplicity copied to clipboard

App will crash if the fb scheme isn't first in CFBundleURLSchemes

Open Vinzius opened this issue 8 years ago • 4 comments

Hey !

First, thanks for your lib 👍

I noticed that if you don't put the fb scheme in the CFBundleURLSchemes list, then the app will produce an error / crash (at least it'll go to preconditionFailure).

Reason if that at this line let urlSchemes = urlTypes.flatMap({($0["CFBundleURLSchemes"] as? [String])?.first }) you take .first, instead you could do a reduce instead of the flatMap.

Would you merge a PR if I were to submit one?

Thanks, Vincent

Vinzius avatar Aug 31 '17 15:08 Vinzius

Sure, go for it!

edjiang avatar Aug 31 '17 18:08 edjiang

Thanks, I'll do that this week! :-)

Vinzius avatar Sep 04 '17 09:09 Vinzius

There's probably some maintenance needed for this project for iOS 11 as well... converting to Swift 3.2/4, and using the new SFAuthenticationSession now that SFVC is no longer persisting auth data across apps.

https://developer.apple.com/documentation/safariservices/sfauthenticationsession

edjiang avatar Sep 07 '17 01:09 edjiang

Hey @edjiang

I'm a bit late, but I'll soon submit a PR for Swift 4.1 + iOS 11.

  • Solved the initial issue with url schemes
  • Try using SFAuthenticationSession if iOS 11+ (but I only tried with FB)
  • Trick to have the button "connect via fb native app"

Cheers

Vinzius avatar Apr 03 '18 12:04 Vinzius