2013-04-02 8 views
7

में Instagram पर छवियों के साथ टेक्स्ट साझा करें मेरे ऐप में मैं Instagram पर एक छवि साझा कर रहा हूं। यह मेरे ऐप में अच्छी तरह से काम कर रहा है।आईओएस

मैं निम्नलिखित कोड का उपयोग कर रहा हूं।

@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 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; 
} 

अब मैं छवि के साथ कुछ पाठ साझा करना चाहता हूं।

जैसा कि नीचे दी गई छवि में दिखाया गया है। "एक कैप्शन लिखें" में, मुझे उदाहरण के लिए कुछ डिफ़ॉल्ट कस्टम टेक्स्ट चाहिए। "इस फोटो को साझा करो"।

मैं यह कैसे कर सकता हूं?

अग्रिम धन्यवाद ...

enter image description here

मैं चित्रों को शेयर करने के लिए मेरे app से Instagram खोलने हूँ संपादित और यह ठीक काम करता है।

लेकिन क्या यह संभव है कि क्या मैं जांच सकता हूं कि उपयोगकर्ता ने इसे सफलतापूर्वक साझा किया है या नहीं?

मतलब है कि जब मैं सफलतापूर्वक एक छवि साझा करता हूं तो मैं अपने डीबी में कुछ कार्रवाई करना चाहता हूं।

मैं यह कैसे कर सकता हूं?

उत्तर

14

मुझे मेरा जवाब मिला। बस एक लाइन जोड़ा और यह मेरे लिए काम किया।

self.dic.annotation = [NSDictionary dictionaryWithObject:@"Here Give what you want to share" forKey:@"InstagramCaption"]; 

धन्यवाद ...

+0

हे, यह मेरे लिए काम नहीं कर रहा है। –

+0

पाठ और छवि जोड़ने के लिए कोई अन्य सेटिंग्स ..? –

3

यह भी http://instagram.com/developer/iphone-hooks/

में आधिकारिक दस्तावेज में दर्ज है आपकी फोटो के साथ एक पहले से भरे शीर्षक में शामिल करने के लिए आप पर एनोटेशन संपत्ति सेट कर सकते हैं कुंजी "InstagramCaption" के तहत एक एनएसएसटींग युक्त एनएस डिक्शनरी के लिए दस्तावेज़ इंटरैक्शन अनुरोध। नोट: यह सुविधा Instagram 2.1 और बाद में उपलब्ध होगी।

+3

अगस्त 2015 तक, Instagram InstagramCaption एनोटेशन को अनदेखा कर रहा है। देखें: http://developers.instagram.com/post/125972775561/removing-pre-filled-captions-from- मोबाइल- शेरिंग – joshrl

1

आपको Instagram या Facebook के साथ प्री-फ़िल टेक्स्ट साझा करने की अनुमति नहीं है।

केवल छवियों/स्क्रीनशॉट को UIDocumentInteractionController के माध्यम से साझा किया जा सकता है।