Saya menambahkan gambar dan beberapa teks di whatsapp dengan bantuan coding. Bagaimana saya bisa melakukannya untuk menyelesaikan masalah saya?
Bagikan Gambar dan Teks di WhatsApp di iOS secara terprogram?
comment
Sudahkah Anda memeriksa posting ini - stackoverflow.com/questions/19524635/ ?
- person May13ank   schedule 19.06.2015
comment
@AshishKakkad saya ingin berbagi gambar dengan teks seperti (gambar dengan keterangan)
- person Anil Jangir   schedule 19.06.2015
Jawaban (1)
Anda dapat memposting Gambar atau Teks di WhatsApp. Tetapi Anda tidak akan memposting keduanya sekaligus karena whatsapp tidak menyediakan API apa pun yang dapat Anda tambahkan keterangan dan posting gambar dengan teks.
Berikut adalah contoh pengeposan gambar dari aplikasi iPhone ke WhatsApp sesuai dengan Dokumentasi WhatsApp:
dalam file ViewController.h:
@interface ViewController : UIViewController
{
}
@property(nonatomic,retain) UIDocumentInteractionController *documentationInteractionController;
di file ViewController.m:
- (IBAction)bocClick:(UIButton *)sender {
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSString *getImagePath = [documentsDirectory stringByAppendingPathComponent:@"savedImage.png"]; //here i am fetched image path from document directory and convert it in to URL and use bellow
NSURL *imageFileURL =[NSURL fileURLWithPath:getImagePath];
NSLog(@"imag %@",imageFileURL);
self.documentationInteractionController.delegate = self;
self.documentationInteractionController.UTI = @"net.whatsapp.image";
self.documentationInteractionController = [self setupControllerWithURL:imageFileURL usingDelegate:self];
[self.documentationInteractionController presentOpenInMenuFromRect:CGRectZero inView:self.view animated:YES];
}
- (UIDocumentInteractionController *) setupControllerWithURL: (NSURL*) fileURL
usingDelegate: (id ) interactionDelegate {
self.documentationInteractionController =
[UIDocumentInteractionController interactionControllerWithURL: fileURL];
self.documentationInteractionController.delegate = interactionDelegate;
return self.documentationInteractionController;
}
person
Nitin Gohel
schedule
19.06.2015