受信した各イメージをアプリケーションディレクトリにダウンロードして保存し、CoreDataにそのイメージへのパスを保存する必要があります。
// Save image to disk
NSString *documentaryPath = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0];
NSString *filePath = [NSString stringWithFormat:@"%@/Image.png",documentaryPath];
NSData *data = [NSData dataWithData:UIImagePNGRepresentation(YOUR_IMAGE)];
[data writeToFile:filePath atomically:YES];
// Retrieve the Image
- (NSData *) imageData {
NSString *docDir = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0];
NSString *pngFilePath = [NSString stringWithFormat:@"%@/Image.png",docDir];
NSData *dataImage = [NSData dataWithContentsOfFile:pngFilePath];
return dataImage;
}
以下のように使用してください。
UIImage *image = [UIImage imageWithData:imageData]
お手数ですが、
それはガードの答えだった....しかし、私はもう少し手伝ってくれますか? – Aashi
はい。あなたがどんな種類の助けを必要としているか教えてください。 – BHUMICA
もし私がその画像やデータフォルダを見たくないのなら...それは私たちが置いた場合の例のために私たち自身のアプリケーションにまだあります。画像フォルダの拡張子ギャラリー@bhumica – Aashi