Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue in following the README for handling incoming requests in the AppDelegate #11

Closed
fabiomassimo opened this issue Jun 11, 2016 · 7 comments

Comments

@fabiomassimo
Copy link
Contributor

From the docs:

Step 2: Handle the incoming requests

Handle the incoming requests in your AppDelegate:

func application(app: UIApplication, openURL url: NSURL, options: [String : AnyObject]) -> Bool {
    github.handleURL(url, options: options)

    return true
}

Unfortunately, while I was following the README, I found out that that the delegate method signature is slightly different:

func application(application: UIApplication, openURL url: NSURL, sourceApplication: String?, annotation: AnyObject) -> Bool

This causes an inconsistency with the designated method to handle an URL from the Provider.

    /**
     Handles the incoming URL.

     - parameter URL:     The incoming URL to handle.
     - parameter options: A dictionary of launch options.
     */
    public func handleURL(URL: NSURL, options: [String : AnyObject])

I think it should be rewritten in something like:

public func handleURL(URL: NSURL, sourceApplication: String?) 

Such that the Step 2 from the README would look like:

func application(application: UIApplication, openURL url: NSURL, sourceApplication: String?, annotation: AnyObject) -> Bool {
    github.handleURL(url, sourceApplication: sourceApplication)

    return true
}
@delba
Copy link
Owner

delba commented Jun 11, 2016

func application(app: UIApplication, openURL url: NSURL, options: [String : AnyObject]) is available in iOS 9 and the other ones are deprecated.

Since I plan to drop the support for iOS8 when iOS10 is released, I think it's better to leave it like that.

@delba delba closed this as completed Jun 11, 2016
@delba
Copy link
Owner

delba commented Jun 11, 2016

@fabiomassimo I changed my mind, I'm gonna support both 😄

I'm gonna do it unless you want to?

@fabiomassimo
Copy link
Contributor Author

On it :)

@delba
Copy link
Owner

delba commented Jun 11, 2016

Ahaha me too

I'm almost done :)

@fabiomassimo
Copy link
Contributor Author

Hahahaha ok I'll step back.

@delba
Copy link
Owner

delba commented Jun 11, 2016

It took me way longer than expected but here it is: f2b743a

@delba
Copy link
Owner

delba commented Jun 11, 2016

Also I encounter a problem when testing on iOS 8.

UIApplicationDidBecomeActiveNotification is called before application:openURL:sourceApplication:annotation: and thus the completion block is called twice. First with Failure(.Cancel) and next with Success(token).

It's maybe because I tested it in the simulator (?)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants