用于登录的twitter集成

时间:2016-10-25 11:44:18

标签: ios xcode twitter

我正在为我的应用程序实现twitter集成。

Function CountColor(rng As Range, clr As Range) As Integer

  Dim c As Range
  Dim a As Integer
  a = 0

  For Each c In rng
      If c.DisplayFormat.Font.Color = clr.Font.Color Then
          a = a + 1
      End If
  Next

  CountColor = a

End Function

但是我得到了回复

SLRequest *twitterInfoRequest = [SLRequest requestForServiceType:SLServiceTypeTwitter requestMethod:SLRequestMethodGET URL:[NSURL URLWithString:@"https://api.twitter.com/1.1/users/show.json"] parameters:[NSDictionary dictionaryWithObject:twitterAccount.username forKey:@"screen_name"]];

1 个答案:

答案 0 :(得分:0)

抱歉,我不熟悉SLRequest,但我给你一个替代解决方案,

使用这些pod行

platform :ios, '8.0'

target 'TwitterLogin'
    pod 'Fabric'
    pod 'TwitterKit'
    pod 'TwitterCore'

在您的info.plist中添加这些代替APIKeyconsumerkeyconsumerSecret

<key>Fabric</key>
    <dict>
        <key>APIKey</key>
        <string>ffXXXXXXXXXXXXXXX14</string>
        <key>Kits</key>
        <array>
            <dict>
                <key>KitInfo</key>
                <dict>
                    <key>consumerKey</key>
                    <string>KjXXXXXXXXXXXXXXXXD</string>
                    <key>consumerSecret</key>
                    <string>3gXXXXXXXXXXXXXXXbd</string>
                </dict>
                <key>KitName</key>
                <string>Twitter</string>
            </dict>
        </array>
    </dict>

然后调用此代码进行登录,

- (IBAction)loginClicked:(id)sender {

    [[Twitter sharedInstance] logInWithCompletion:^(TWTRSession * _Nullable session, NSError * _Nullable error) {
        if (session) {
            NSLog(@"%@", [session userID]);
            NSLog(@"%@", [session userName]);
            NSLog(@"%@", [session authToken]);
            NSLog(@"%@", [session authTokenSecret]);
        } else {
            NSLog(@"Error: %@", [error localizedDescription]);
        }
    }];

}

希望这可以帮助你!!