且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

从iOS将视频分享到Instagram提要

更新时间:2023-01-01 16:42:56

进入上述屏幕的唯一方法是先将视频保存在库中,然后使用未记录的挂钩instagram://library传递资产.不要忘记在info.plist中添加instagram查询方案.

The only way to get to the screen illustrated above is to save first the video in the library and then use the undocumented hook instagram://library passing the asset localIdentifier. Don't forget to add instagram query scheme in the info.plist.

if UIApplication.shared.canOpenURL("instagram://app") { // has Instagram
    let url = URL(string: "instagram://library?LocalIdentifier=" + videoLocalIdentifier)

    if UIApplication.shared.canOpenURL(url) {
        UIApplication.shared.open(url, options: [:], completionHandler:nil)
    }
}