2013-03-01 25 views
5

Tôi muốn chia sẻ văn bản/ảnh/video vào Instagram. Tôi đang tìm kiếm điều này trong một thời gian dài nhưng tôi đã không nhận được bất kỳ tài liệu thích hợp. Nếu ai biết về chia sẻ trên instagram xin vui lòng cho tôi biết.Cách chia sẻ văn bản/ảnh/video vào Instagram trong ios

+0

sử dụng mã dưới đây bạn có thể đăng ảnh nhưng mã này sẽ mở camera và sau đó nhấp ảnh sẽ được tải lên từ ứng dụng của bạn để instagram. NSURL * instagramURL = [URL của NSURLVí dụ: @ "instagram: // location? Id = 1"]; nếu ([[UIApplication sharedApplication] canOpenURL: instagramURL]) { [[UIApplication sharedApplication] openURL: instagramURL]; } –

Trả lời

0

Hãy thử mã sau.

@property (nonatomic, retain) UIDocumentInteractionController *dic;  

CGRect rect = CGRectMake(0 ,0 , 0, 0); 
UIGraphicsBeginImageContextWithOptions(self.view.bounds.size, self.view.opaque, 0.0); 
[self.view.layer renderInContext:UIGraphicsGetCurrentContext()]; 
UIGraphicsEndImageContext(); 
NSString *jpgPath = [NSHomeDirectory() stringByAppendingPathComponent:@"Documents/test.igo"]; 

NSURL *igImageHookFile = [[NSURL alloc] initWithString:[[NSString alloc] initWithFormat:@"file://%@", jpgPath]]; 
// NSURL *igImageHookFile = [[NSURL alloc] initWithString:[[NSString alloc] initWithFormat:@"file://%@", screenshot]]; 

self.dic.UTI = @"com.instagram.photo"; 
self.dic = [self setupControllerWithURL:igImageHookFile usingDelegate:self]; 
self.dic=[UIDocumentInteractionController interactionControllerWithURL:igImageHookFile]; 
self.dic.annotation = [NSDictionary dictionaryWithObject:@"Here Give what you want to share" forKey:@"InstagramCaption"]; 
[self.dic presentOpenInMenuFromRect: rect inView: self.view animated: YES ]; 


- (UIDocumentInteractionController *) setupControllerWithURL: (NSURL*) fileURL usingDelegate: (id <UIDocumentInteractionControllerDelegate>) interactionDelegate { 
UIDocumentInteractionController *interactionController = [UIDocumentInteractionController interactionControllerWithURL: fileURL]; 
interactionController.delegate = interactionDelegate; 
return interactionController; 
} 

Nó phù hợp với tôi. Hy vọng nó sẽ giúp bạn.

2

Instagram Media Endpoints

Tại thời điểm này, tải lên qua API là không thể. Chúng tôi đã lựa chọn có ý thức không thêm điều này vì các lý do sau:

Instagram là về cuộc sống của bạn khi di chuyển - chúng tôi hy vọng khuyến khích ảnh từ bên trong ứng dụng. Tuy nhiên, trong tương lai, chúng tôi có thể cấp cho các ứng dụng trắng quyền truy cập vào từng ứng dụng riêng lẻ.

Chúng tôi muốn chống spam & ảnh chất lượng thấp. Khi chúng tôi cho phép tải lên từ các nguồn khác, khó kiểm soát những gì xảy ra trong hệ sinh thái Instagram . Tất cả điều này đang được nói, chúng tôi đang làm việc theo cách để đảm bảo người dùng có trải nghiệm nhất quán và chất lượng cao trên nền tảng của chúng tôi.

Có lẽ bạn có thể thử một cái móc: http://instagram.com/developer/iphone-hooks/ hoặc https://instagram.com/developer/mobile-sharing/android-intents/

Các vấn đề liên quan