iOS11からTwitterKitを使わないとツイートできなくなったので、インストールしました。
ツイートのためのウィンドウは表示されるのですが、ツイートボタンを押しても「ツイートを送信できません。」というダイアログが出て、一向にツイートできません。
イニシャルテキスト、URL、画像を追加しても追加しなくても状況は同じです。
ネットで検索すると同様の問題を抱えてる海外の人の質問が若干ありましたが、解決してる様子がありません。
特定の文字を使うとツイートがうまくいかないという情報がありましたが、テキストなしの画像だけでもうまくいきません。
《追記》試したところ、iPhone/iPadシミュレータではiOS11とiOS10.3の両方からツイートできました。要するに実機でのみ起きる現象のようです。
どこがいけないのか、そして解決にはどうしたらいいでしょうか?
または同じ現象が起こっている方がいたらコメントいただけると嬉しいです。
インストールしたファイル
TwitterKit3
- TwitterCore.framework(ver3.0.1)
- TwitterKit.framework(ver3.1.1)
- TwitterKitResources.bundle
Info.plistに指示どおりコンシューマキーを含む項目を追加しました。
AppDelegateに以下を追加しました。
Swift
1func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { 2 //TwitterKit初期設定 3 Twitter.sharedInstance().start(withConsumerKey: "コンシューマキー", 4 consumerSecret: "コンシューマシークレット") 5 6 return true 7 }
Swift
1func application(_ app: UIApplication, open url: URL, options: [UIApplicationOpenURLOptionsKey : Any] = [:]) -> Bool { 2 3 return Twitter.sharedInstance().application(app, open: url, options: options) 4 }
ツイート用のボタンには以下のように書いています。
Swift
1@IBAction func actionBtn(_ sender: AnyObject) { 2 //Twitterログイン認証トークンの有無を確認 3 if Twitter.sharedInstance().sessionStore.hasLoggedInUsers() { 4 //ツイート 5 let composer = TWTRComposer() 6 //ツイートのウィンドウ表示 7 composer.show(from: self) { (result) in 8 if result == TWTRComposerResult.done { 9 print("ツイートされた") 10 } else { 11 print("ツイートできなかった") 12 } 13 } 14 } else { 15 //Twitterログイン処理 16 Twitter.sharedInstance().logIn(completion: { (session, error) in 17 if session != nil { 18 print("signed in as (String(describing: session?.userName))") 19 } else { 20 print("error: (String(describing: error?.localizedDescription))") 21 } 22 }) 23 } 24 }
エラーメッセージとして以下のものが出ます。
CredStore - performQuery - Error copying matching creds. Error=-25300, query={
class = inet;
"m_Limit" = "m_LimitAll";
ptcl = htps;
"r_Attributes" = 1;
sdmn = "https://api.twitter.com";
srvr = "api.twitter.com";
sync = syna;
}
[288:16606] Did encounter error sending Tweet: Error Domain=TWTRNetworkingErrorDomain Code=-1011 "Request failed: unauthorized (401)" UserInfo={NSLocalizedFailureReason=, TWTRNetworkingStatusCode=401, NSErrorFailingURLKey=https://api.twitter.com/1.1/statuses/update.json, NSLocalizedDescription=Request failed: unauthorized (401)}
[288:16606] [TwitterKit] Composer did fail: Error Domain=TWTRNetworkingErrorDomain Code=-1011 "Request failed: unauthorized (401)" UserInfo={NSLocalizedFailureReason=, TWTRNetworkingStatusCode=401, NSErrorFailingURLKey=https://api.twitter.com/1.1/statuses/update.json, NSLocalizedDescription=Request failed: unauthorized (401)}

回答2件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2017/09/25 12:48
2017/09/25 14:04
2017/09/25 14:22
2017/09/25 14:23
2017/09/25 14:32
2017/09/25 14:39
2017/09/25 14:44 編集
2017/09/25 14:49
2017/09/25 14:51
2017/09/25 14:58
2017/09/25 14:59
2017/09/25 15:01 編集
2017/09/25 15:03
2017/09/25 15:03
2017/09/25 15:04
2017/09/25 15:17
2017/09/25 15:18
2017/09/25 16:24
2017/09/25 17:47
2017/09/25 22:31
2017/09/25 23:57
2017/09/27 07:13
2017/09/27 07:14
2017/09/27 07:14
2017/09/27 07:21
2017/09/27 07:52
2017/09/27 07:58
2017/09/27 08:06
2017/09/27 08:10
2017/09/27 08:15
2017/09/27 08:20
2017/09/27 08:23
2017/09/27 08:29
2017/09/27 10:05
2017/09/27 10:37
2017/09/27 11:33