我有一组来自照片库的图像路径。我需要通过我的 Facebook 应用发布这些照片。但我收到错误 324,“需要上传文件”。我认为我从路径获取 NSData 的方式是错误的。有什么帮助吗?
NSData *imageData = [NSData dataWithContentsOfURL:[NSURL URLWithString: URLImages[i]]];
NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
messageTextView.text, @"message", imageData, @"source", nil];
但是当我在项目中对图像进行硬编码时,它可以工作
NSString *filePath = [[NSBundle mainBundle] pathForResource:@"IMAG0386" ofType:@"jpg"];
NSData *imageData = [NSData dataWithContentsOfFile:filePath];
mosaicShareImages[i]]];
NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
messageTextView.text, @"message", imageData, @"source", nil];