uber / rides-ios-sdk

Uber Rides iOS SDK (beta)
https://developer.uber.com/docs
MIT License
374 stars 124 forks source link

open sourceApplication deprecated crash #235

Closed lbonga1 closed 6 years ago

lbonga1 commented 6 years ago

After updating to the newest version of Xcode (9.3), I am suddenly getting a EXC_BAD_ACCESS crash at the line of code BOOL handledURL = [[UBSDKAppDelegate shared] application:app open:url sourceApplication:options[UIApplicationOpenURLOptionsSourceApplicationKey] annotation:options[UIApplicationOpenURLOptionsAnnotationKey]];

I am thinking this may be because application(_ application: UIApplication, open url: URL, sourceApplication: String?, annotation: Any) -> Bool was deprecated then removed in iOS 10? Any guidance on how to resolve this issue?

lbonga1 commented 6 years ago

Update: I unlocked the UberAppDelegate.swift file and added the method


    @objc public func application(_ app: UIApplication, open url: URL, options: [UIApplicationOpenURLOptionsKey : Any]) -> Bool {
        guard let manager = loginManager else {
            return false
        }

        let urlHandled = manager.application(app, open: url, options: options)
        if (urlHandled) {
            loginManager = nil
        }

        return urlHandled
    } ```

which I used instead of 

```@objc public func application(_ application: UIApplication, open url: URL, sourceApplication: String?, annotation: Any) -> Bool {
        guard let manager = loginManager else {
            return false
        }
        let urlHandled = manager.application(application, open: url, sourceApplication: sourceApplication, annotation: annotation)
        if (urlHandled) {
            loginManager = nil
        }

        return urlHandled
    }```

and it is working as expected.
edjiang commented 6 years ago

I believe this should fix your issue: #233