2017-08-29 17 views
1

登錄成功後總是得到低於錯誤的重定向未被重定向到我的app.it將繼續加載。推特套件 - 授權後重定向不適用於iOS 11測試版

"Redirecting you back to the application.This may take a few moments." 

[TwitterKit]做了與消息遭遇錯誤「無法使用該系統的帳戶進行認證。」:錯誤域= TWTRLogInErrorDomain代碼= 0「用戶拒絕訪問系統帳戶」的UserInfo = {NSLocalizedDescription =用戶拒絕訪問系統帳戶,NSLocalizedRecoverySuggestion =授予該用戶對系統的Twitter帳戶的訪問。}

ViewController.m

 [[Twitter sharedInstance] startWithConsumerKey:@"1diEEBruGq9X5HKr0FyK3vFGF" consumerSecret:@"YIOD1rPx1tEuYJRLRYpl8ApT8YdWQpilnApJ8R67VaD3KePAU3"]; 
    [[Twitter sharedInstance] logInWithCompletion:^(TWTRSession *session, NSError *error) { 
     if (session) { 

      TWTRComposer *composer = [[TWTRComposer alloc] init]; 

      [composer setText:@"just setting up my Twitter Kit"]; 
      [composer setImage:[UIImage imageNamed:@"twitterkit"]]; 

      // Called from a UIViewController 
      [composer showFromViewController:delegate.window.rootViewController completion:^(TWTRComposerResult result) { 
       if (result == TWTRComposerResultCancelled) { 
        NSLog(@"Tweet composition cancelled"); 
       } 
       else { 
        NSLog(@"Sending Tweet!"); 
       } 
      }]; 

     } else { 
      NSLog(@"error: %@", [error localizedDescription]); 
     } 
    }]; 

AppDelegate.m

- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url 
     options:(NSDictionary *) options 
{ 

[[Twitter sharedInstance] application:application openURL:url options:options]; 
return YES; 
} 

enter image description here

回答

0

從iOS 11開始,Apple已從iOS中刪除社交帳戶。

您應該使用Twitter Kit 3 for iOS。

參考Twitter的博客https://dev.twitter.com/twitterkit/ios/migrate-social-framework

UPDATE

的AppDelegate

import TwitterKit 

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { 
// Intialize Twitter Kit 
     Twitter.sharedInstance().start(withConsumerKey:consumer_key, consumerSecret:consumer_secret) 
} 

func application(_ app: UIApplication, open url: URL, options: [UIApplicationOpenURLOptionsKey : Any] = [:]) -> Bool { 
     if Twitter.sharedInstance().application(app, open: url, options: options) { 
      return true 
     } 

return false 
} 

的ViewController

import TwitterKit 

override func viewDidLoad() { 
     super.viewDidLoad() 

     Twitter.sharedInstance().logIn(with: self, completion: { (session, error) in 

      if let sess = session { 
       print("signed in as \(sess.userName)"); 
      } else { 
       print("error: \(String(describing: error?.localizedDescription))"); 
      } 
     }) 

    } 

Info.plis

<key>CFBundleURLTypes</key> 
    <array> 
     <dict> 
      <key>CFBundleURLSchemes</key> 
      <array> 
       <string>twitterkit-{your consumer key}</string> 
      </array> 
     </dict> 
    </array> 
    <key>LSApplicationQueriesSchemes</key> 
    <array> 
     <string>twitter</string> 
     <string>twitterauth</string> 
    </array> 
+0

是啊引用鏈接只是沒有得到重定向 – Ravindhiran

+0

我試圖使用Twitter的登錄方法與ViewController和登錄成功和重定向成功。在iPhone 7 Plus/iOS 11模擬器上測試。 (void)logInWithViewController:(可爲空的UIViewController *)viewController完成:(TWTRLogInCompletion)完成; – Basheer

+0

你能分享我的代碼嗎? – Ravindhiran