0

我正在开发flutter项目,我尝试使用flutter_twitter插件登录Twitter。它适用于Android,但使用iOS登录时遇到问题。我搜索它但没有成功。登录IOS时也抛出异常对我没有帮助。请帮助我如何解决它。

信息列表

<key>CFBundleURLTypes</key>
<array>
    <dict>
        <key>CFBundleTypeRole</key>
        <string>Editor</string>
        <key>CFBundleURLSchemes</key>
        <array>
            <string>fb26143136******</string>
        </array>
    </dict>
    <dict>
        <key>CFBundleTypeRole</key>
        <string>Editor</string>
        <key>CFBundleURLSchemes</key>
        <array>
            <string>com.googleusercontent.apps.433638145101-40qg2d9uiq4v5t*********</string>
        </array>
    </dict>
    <dict>
        <key>CFBundleTypeRole</key>
        <string>Editor</string>
        <key>CFBundleURLSchemes</key>
        <array>
          <string>twitterkit-mmjB8lbQe3wsBhx*********></string>
        </array>
      </dict>
</array>

<key>LSApplicationQueriesSchemes</key>
<array>
    <string>fbapi</string>
    <string>fb-messenger-share-api</string>
    <string>fbauth2</string>
    <string>fbshareextension</string>
    <string>twitter</string>
    <string>twitterauth</string>
</array>

颤振代码

 var twitterLogin = new TwitterLogin(
 consumerKey: '**jB8lbQe3wsB****',
 consumerSecret:'***j5DrXVTU45mo6fb**********',
 );

Future<void> loginWithTwitter() async {
final TwitterLoginResult result = await twitterLogin.authorize();

switch (result.status) {
  case TwitterLoginStatus.loggedIn:
    var session = result.session;
    print(session.token);
    print(session.secret);
    break;
  case TwitterLoginStatus.cancelledByUser:
    print("Cancelled");
    break;
  case TwitterLoginStatus.error:
    print(result.errorMessage);
    break;
 }
}

错误日志

      *** First throw call stack:
 (
 0   CoreFoundation                      0x00007fff23baa1ee       __exceptionPreprocess + 350
 1   libobjc.A.dylib                     0x00007fff50864b20    objc_exception_throw + 48
 2   CoreFoundation                      0x00007fff23baa02c +[NSException raise:format:] + 188
 3   TwitterKit                          0x0000000106df38ad -[TWTRTwitter logInWithViewController:completion:] + 649
 4   Runner                              0x00000001023ded4d -[TwitterLoginPlugin authorize:] + 205
 5   Runner                              0x00000001023de83f -[TwitterLoginPlugin handleMethodCall:result:] + 335
 6   Flutter                             0x0000000104d0d4fd __45-[FlutterMethodChannel setMethodCallHandler:]<…&gt;
 Lost connection to device.
4

1 回答 1

0

您应该只有一个 CFBundleTypeRole 并且在数组中放置来自提供者 ex.google、twitter、facebook 等的所有密钥。

像这样:

 <dict>
    <key>CFBundleTypeRole</key>
    <string>Editor</string>
    <key>CFBundleURLSchemes</key>
    <array>
      <string>com.googleusercontent.apps.433638145101-40qg2d9uiq4v5t*********</string>
      <string>twitterkit-mmjB8lbQe3wsBhx*********></string>
    </array>
  </dict>
于 2019-11-11T22:21:31.083 回答