Twiter SDK integration issues

ios
oauth
login
twitterkit

#1

I’m implementing Twitter oAuth on an app that has compatibility with iOS 8+ and uses CocoaPods to integrate Fabric artefacts.

ISSUE 1:
For iOS 8, Twitter seems not to provide a convenient application method to handle deep link, what should I do?

Current code:

@available(iOS 9.0, *)
    func application(app: UIApplication, openURL url: NSURL, options: [String : AnyObject]) -> Bool {

        if Twitter.sharedInstance().application(app, openURL: url, options: options) {
            return true
        }

        return false
    }

    @available(iOS, introduced=8.0, deprecated=9.0)
    func application(application: UIApplication,openURL url: NSURL, sourceApplication: String?, annotation: AnyObject) -> Bool {

        // WHAT TO DO HERE?
//        if Twitter.sharedInstance().application(application, openURL: url, options: options) {
//            return true
//        }

        return false
    }

ISSUE 2:
Plus, for some reason on iOS 8, the web login is displayed but the user interaction is disabled, so basically the user is stuck there and the application needs to be closed.

ISSUE 3:
Following the Fabric steps to integrate Twitter using the Mac app, I got stuck in the final step which is “Verifying installation”. I ended up doing manually, (creating an app, changing info.plist manually, etc) and it works for iOS 9. I would like to use it through Fabric since I’m using Crashlytics through it too.


#2

Hey @clackmac,

For the third issue, can you try this out? Quit Fabric.app and run this command: rm -rf ~/Library/Caches/com.crashlytics.mac Then relaunch Fabric.app and build and run your app once more?

For the second issue - I haven’t been able to reproduce this locally - what device are you seeing this on? Also, which version of Twitter Kit are you using?

For the first issue - do you mean a deep link into the Twitter app from the content you’re displaying within your app?

-Mike


#3

Hey thanks!, I’ll check that out and let you know…


#4

Hey @bonnell , to your questions:

ISSUE 1: No, it’s the ability for the Twitter framework to handle incoming links from the openURL method on the appDelegate of my app for iOS 8. This is needed for the auth workflow to finish correctly on iOS as mentioned here: https://docs.fabric.io/apple/twitter/advanced-setup.html#notify-twitter-kit-of-openurl

ISSUE 2: I’m testing it in the iOS simulator, iPhone 6 with iOS 8.4. Currently dont have a real device with iOS 8 around, but I it doesn’t seem is a simulator thing.

ISSUE 3: I followed your steps but I keep getting the same behavior. Not sure it helps but I also using Crashlytics from the Fabric familiy as well so my pod file also includes the crashlytics pod:

platform :ios, '8.0'
use_frameworks!

target 'MyApp' do

  #Twitter
  pod 'Fabric'
  pod 'Crashlytics'
  pod 'TwitterKit'
  pod 'TwitterCore'

// + other pods... 

Any other ideas?