iOS APP分享內(nèi)容到Twitter三句代碼
花了一天時(shí)間最后三句代碼搞定分享Twitter
遇到的過程
1萝映、蘋果自帶的UIActivityViewController Twitter是不能分享的
2吴叶、在git上找到sdk發(fā)現(xiàn)停止更新了(還去試了一遍,需要授權(quán)相當(dāng)沒用)?https://blog.twitter.com/developer/en_us/topics/tools/2018/discontinuing-support-for-twitter-kit-sdk.html
3序臂、最后:
?? NSString * encodedString = [NSString stringWithFormat:@"twitter://post?message=%@\n%@",textToShare,contentURL.absoluteString];
? ? ? ? ? ? encodedString = [encodedStringstringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]];
? ? ? ? ? ? DLog(@"轉(zhuǎn)碼url:%@",? encodedString);
? ? ? ? ? ? [[UIApplication sharedApplication] openURL:[NSURL URLWithString:encodedString]];