我试图使用UIActivityViewController与主题标签共享图像,我在尝试分享到Twitter,Facebook和Instagram时遇到了一些奇怪的行为.似乎没有关于这些服务的共享扩展的大量文档.
场景1:Init控制器,带有包含图像和文本的活动项目数组
如果我像这样初始化控制器,Twitter和Facebook将显示在控制器中(没有Instagram,因为它不支持文本项),并且两者都将以编程方式预先填充文本输入字段中的#标签:
let activityVC = UIActivityViewController(activityItems: [myHashtagString, myImage], applicationActivities: nil)
Run Code Online (Sandbox Code Playgroud)
场景2:仅具有图像的Init控制器
在这种情况下,所有网络都会显示,但我(显然)会丢失自动主题标签功能:
let activityVC = UIActivityViewController(activityItems: [myImage], applicationActivities: nil)
Run Code Online (Sandbox Code Playgroud)
场景3:UIActivityItemSource子类
如果我创建自己的UIActivityItemSource子类,我几乎可以完成所有工作.然而,这是我无法弄清楚的,使用我下面的协议方法导致自动主题标签适用于Facebook,但不是Twitter.这怎么可能 - 推特需要一个特殊的密钥吗?如果在场景#1中工作,必须有一种方法可以工作......
有趣的是,如果我插入一个URL(注释掉),这种方法适用于Twitter和Facebook.那么为什么地球上的文字不适用于Twitter!?
let activityItem = CustomItemSource(image: image, message: "#TestTag")
let activityVC = UIActivityViewController(activityItems: [activityItem], applicationActivities: nil)
...
class CustomItemSource: NSObject, UIActivityItemSource {
private var image: UIImage!
private var message: String!
// MARK: Init
init(image: UIImage, message: String) {
super.init()
self.image = image
self.message = message
}
// MARK: Item Source Protocol
func activityViewControllerPlaceholderItem(_ activityViewController: UIActivityViewController) -> Any …Run Code Online (Sandbox Code Playgroud) 我在我的iOS应用程序中使用以下代码来使用Instagram iPhone挂钩将照片发布到Instagram.我只希望"Open In ..."菜单中有Instagram应用程序,没有其他应用程序.但在我的情况下,Camera +也出现了.我怎么能限制在Instagram?
另外,我可以直接打开Instagram而不是显示Open In菜单吗?
NSURL *instagramURL = [NSURL URLWithString:@"instagram://app"];
if ([[UIApplication sharedApplication] canOpenURL:instagramURL]) {
//imageToUpload is a file path with .ig file extension
self.documentInteractionController = [UIDocumentInteractionController interactionControllerWithURL:[NSURL fileURLWithPath:imageToUpload]];
self.documentInteractionController.UTI = @"com.instagram.photo";
self.documentInteractionController.annotation = [NSDictionary dictionaryWithObject:@"my caption" forKey:@"InstagramCaption"];
[self.documentInteractionController presentOpenInMenuFromBarButtonItem:self.exportBarButtonItem animated:YES];
}
Run Code Online (Sandbox Code Playgroud) 这是我的代码.该文件已正确添加到照片库,但在Instagram应用程序中此网址 - > instagram://library?AssetPath=assets-library%3A%2F%2Fasset%2Fasset.mp4%3Fid=5EDBD113-FF57-476B-AABB-6A59F31170B5&ext=mp4&InstagramCaption=my%caption不打开最后一个视频.
- (void)loadCameraRollAssetToInstagram:(NSURL*)assetsLibraryURL andMessage:(NSString*)message
{
NSString *escapedString = [self urlencodedString:assetsLibraryURL.absoluteString];
NSString *escapedCaption = [self urlencodedString:message];
NSURL *instagramURL = [NSURL URLWithString:[NSString stringWithFormat:@"instagram://library?AssetPath=%@&InstagramCaption=%@", escapedString, escapedCaption]];
NSLog(@"instagramURL ==> %@",instagramURL);
if ([[UIApplication sharedApplication] canOpenURL:instagramURL]) {
NSLog(@"Open Instagram!!");
[[UIApplication sharedApplication] openURL:instagramURL];
} else {
NSLog(@"Cant open Instagram!!");
[[[UIAlertView alloc] initWithTitle:@"Instagram" message:@"App not installed" delegate:nil cancelButtonTitle:@"Ok" otherButtonTitles:nil, nil] show];
}
}
- (NSString*)urlencodedString:(NSString *)message
{
return [message stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLHostAllowedCharacterSet]];
}
- (void)saveToCameraRoll:(NSURL *)srcURL withCurrentAction:(NSString *)action
{
ALAssetsLibrary *library = [[ALAssetsLibrary alloc] init]; …Run Code Online (Sandbox Code Playgroud) 我正在开发一个iOS Xcode 7 Swift 2项目.该应用程序发布照片Facebook和Twitter使用:
var shareToFacebook: SLComposeViewController = SLComposeViewController(forServiceType: SLServiceTypeFacebook)
Run Code Online (Sandbox Code Playgroud)
和
var shareToTwitter: SLComposeViewController = SLComposeViewController(forServiceType: SLServiceTypeTwitter)
Run Code Online (Sandbox Code Playgroud)
喜欢将照片发布到这两个社交媒体是多么容易和简单.我不需要或想要它们的API.
我想做类似和简单的事情Instagram.在不必处理的情况下,最好的方法是什么Instagram API?或者我别无选择?
我的照片data是使用保存的NSCoding,而不是保存在DocumentDirectory.我在这里寻找集成,但这是为了保存在应用程序中的照片directory.
就像我已经拥有的Facebook和Twitter一样简单.
使用IOS,我试图将LinkedIn集成到应用程序中.集成也正常,用户登录也有效,但是我无法获取用户配置文件的数据,其中所有用户记录为Education,Skills等.成功登录后,我只能获得这四个值.-first-name -site-standard-profile-request -last-name -headline
任何人都可以取得所有的价值而不是这些.谢谢,谢谢.
我一直在寻找一种方式,从我正在开发的iOS应用程序发布照片到Instagram.但是看到一些链接,似乎他们不支持使用他们的API进行写访问.所以,
他们的api说这个......
"目前,无法通过API上传.我们有意识地选择不添加此内容,原因如下:
Instagram是关于你在旅途中的生活 - 我们希望鼓励应用程序内的照片.但是,将来我们可能会根据具体情况授予白名单访问个人应用程序的权限.我们想要打击垃圾邮件和低质量的照片.一旦我们允许从其他来源上传,就很难控制Instagram生态系统中的内容.所有这些都说明了,我们正在努力确保用户在我们的平台上获得一致和高质量的体验."
这就是为什么我在寻找更好的建议.
在此先感谢您的帮助.
我正在尝试将带有一些文本和网址的图像从我的应用程序共享到 Instagram,稍后会从 Instagram 应用程序重定向到手机上安装的 iOS 应用程序。我可以在 Instagram 上分享图像,但不能分享文本和网址。任何与此相关的帮助都会很棒!