0
我要在編碼的幫助下在whatsapp中添加圖像和一些文本。我怎樣才能解決我的問題?以編程方式在IOS中的WhatsApp上分享圖像和文本?
我要在編碼的幫助下在whatsapp中添加圖像和一些文本。我怎樣才能解決我的問題?以編程方式在IOS中的WhatsApp上分享圖像和文本?
您可以在WhatsApp上發佈圖片或文字。但是你不會發布兩次,因爲whatsapp沒有提供任何API,你可以添加標題和文字圖像。
以下是從iPhone應用程序發佈圖像的WhatsApp與參數WhatsApp Documentation一個例子:
在ViewController.h文件:
@interface ViewController : UIViewController
{
}
@property(nonatomic,retain) UIDocumentInteractionController *documentationInteractionController;
在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;
}
您是否檢查了此帖 - http://stackoverflow.com/questions/1952463 5/how-send-image-to-whatsapp-from-my-application? – May13ank
@AshishKakkad我想分享一個像文字一樣的圖像(帶有標題的圖像) –