Instagram分享
2015-11-20 11:43
323 查看
分享图片
The answer is that it is not pulling the video from the camera roll at all, it might just look like it is.
Documentation here: http://instagram.com/developer/mobile-sharing/iphone-hooks/
The relevant bit is the bottom section "Document Interaction".
You would do this by doing something like this:
Set the data, the caption, and the view to present from yourself. Notice the
also a property. It should be retained somewhere and not just a local variable in a method because it needs to exist outside of that scope when the method completes.
分享视频
- (void)shareVideoWithInstagram {
[assetsLibrary writeVideoAtPathToSavedPhotosAlbum:[NSURL fileURLWithPath:videoPath] completionBlock:^(NSURL *assetURL, NSError *error)
{
NSString *caption =
@"Your caption";
NSURL *instagramURL = [NSURL
URLWithString:[NSString
stringWithFormat:@"instagram://library?AssetPath=%@&InstagramCaption=%@",
[[assetURL
absoluteString] stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet
alphanumericCharacterSet]],
[caption
stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet
alphanumericCharacterSet]]]
];
if ([[UIApplication
sharedApplication]
canOpenURL:instagramURL]) {
[[UIApplication
sharedApplication] openURL:instagramURL];
}
}
The answer is that it is not pulling the video from the camera roll at all, it might just look like it is.
Documentation here: http://instagram.com/developer/mobile-sharing/iphone-hooks/
The relevant bit is the bottom section "Document Interaction".
You would do this by doing something like this:
NSString *filePath = [NSTemporaryDirectory() stringByAppendingPathComponent:@"instagram.igo"]; NSData *data = // set this yourself NSError *error = nil; if (! [data writeToFile:filePath options:NSDataWritingAtomic error:&error]) { // error here } self.documentInteractionController = [UIDocumentInteractionController interactionControllerWithURL:[NSURL fileURLWithPath:filePath]]; self.documentInteractionController.delegate = self; self.documentInteractionController.UTI = @"com.instagram.exclusivegram"; self.documentInteractionController.annotation = @{ @"InstagramCaption" : @"caption text here" }; const BOOL couldOpen = [self.documentInteractionController presentOpenInMenuFromRect:CGRectZero inView:myView animated:YES];
Set the data, the caption, and the view to present from yourself. Notice the
UIDocumentInteractionControlleris
also a property. It should be retained somewhere and not just a local variable in a method because it needs to exist outside of that scope when the method completes.
分享视频
- (void)shareVideoWithInstagram {
[assetsLibrary writeVideoAtPathToSavedPhotosAlbum:[NSURL fileURLWithPath:videoPath] completionBlock:^(NSURL *assetURL, NSError *error)
{
NSString *caption =
@"Your caption";
NSURL *instagramURL = [NSURL
URLWithString:[NSString
stringWithFormat:@"instagram://library?AssetPath=%@&InstagramCaption=%@",
[[assetURL
absoluteString] stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet
alphanumericCharacterSet]],
[caption
stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet
alphanumericCharacterSet]]]
];
if ([[UIApplication
sharedApplication]
canOpenURL:instagramURL]) {
[[UIApplication
sharedApplication] openURL:instagramURL];
}
}
相关文章推荐
- 峰回路转,Firefox 浏览器即将重返 iOS 平台
- 峰回路转,Firefox 浏览器即将重返 iOS 平台
- 数码文件与文件夹收纳术(以照片为例)
- 不可修补的 iOS 漏洞可能导致 iPhone 4s 到 iPhone X 永久越狱
- iOS 12.4 系统遭黑客破解,漏洞危及数百万用户
- 每日安全资讯:NSO,一家专业入侵 iPhone 的神秘公司
- [转][源代码]Comex公布JailbreakMe 3.0源代码
- DVI 视频接口图文解析
- C#实现语音视频录制-附demo源码
- C#调用mmpeg进行各种视频转换的类实例
- C#获取视频某一帧的缩略图的方法
- 显示youtube视频缩略图和Vimeo视频缩略图代码分享
- 讲解iOS开发中基本的定位功能实现
- js判断客户端是iOS还是Android等移动终端的方法
- IOS开发环境windows化攻略
- 浅析iOS应用开发中线程间的通信与线程安全问题
- 检测iOS设备是否越狱的方法
- .net平台推送ios消息的实现方法
- PHP使用ffmpeg给视频增加字幕显示的方法