IOS(swift)-社交媒体 ·使用social.Framew

作者: 俊瑶先森 | 来源:发表于2015-01-28 02:27 被阅读892次

social.Framework提供了常见的社交媒体分享API。这样我们不需要导入SDK。
提供了

SLServiceTypeFacebook
SLServiceTypeSinaWeibo
SLServiceTypeTencentWeibo
SLServiceTypeTwitter

首先我们要导入Social

import Social
 @IBAction func saveAction(sender: AnyObject) {
        var controller:SLComposeViewController = SLComposeViewController(forServiceType: SLServiceTypeSinaWeibo)
        controller.setInitialText("分享内容")
        controller.addImage(nil)
        self.presentViewController(controller, animated: true, completion: nil)
    }

记住微博分享需要在真机下测试。否则报错

相关文章

网友评论

    本文标题:IOS(swift)-社交媒体 ·使用social.Framew

    本文链接:https://www.haomeiwen.com/subject/jktlxttx.html