twitter-archive / twitter-kit-ios

Twitter Kit is a native SDK to include Twitter content inside mobile apps.
Apache License 2.0
688 stars 449 forks source link

IOS removing UIWebView #120

Open maximus123123 opened 4 years ago

maximus123123 commented 4 years ago

This package uses UIWebView, Is there a way of removing just that section?

ITMS-90809: Deprecated API Usage - Apple will stop accepting submissions of apps that use UIWebView APIs . See https://developer.apple.com/documentation/uikit/uiwebview for more information.

touren commented 4 years ago

I created a new pod TwitterKit5, migrated from UIWebView to WKWebView. Hope that will help.

pod 'TwitterKit5'
HackingGate commented 4 years ago

@touren Thank you for your work. But it's crashing.

After investigating in the DemoApp. The first time it will use SFSafariViewController and everything goes right. When any session is stored, it will use WKWebView instead. My project will crash here.

- (UIViewController *)webController
{
    if (_useWebFlow) {
        // My project goes crash when WKWebView being used
        return [self webViewController];
    } else {
        // No crash here
        [self.navigationController setNavigationBarHidden:YES];
        return [self safariViewController];
    }
}

I've created https://github.com/touren/twitter-kit-ios/pull/2 for you, so DemoApp is able to run.

If anyone got crashing and is in a hurry. The workaround is to change _useWebFlow to NO, it will force SFSafariViewController to be used every time to prevent the crash. Since UIWebView is not referenced in the code it should be able to submit to the App Store.

Don't know why TwitterKit uses two different ways for non-app auth. Please correct me if anything is wrong.

touren commented 4 years ago

@HackingGate Thanks for your solution. Could you please share the steps you did to crash the DemoApp?

HackingGate commented 4 years ago

Hi @touren Here's the steps to reproduce.

  1. Don't install Twitter app
  2. Create a Xcode project. Install pod 'TwitterKit5'
  3. Implement Log In With Twitter, create a button, let's call it "login"
  4. Tap "login", SafariViewController popped up.
  5. Enter username and password then login
  6. SafariViewController dismissed and Log In With Twitter is completed
  7. Tap "login" again
  8. Crash
touren commented 4 years ago

@HackingGate Thanks for your instructions. I published TwitterKit5 v5.0.2, fixed the crash.

pod 'TwitterKit5'