6

URL から画像をダウンロードし、それを Objective-C を使用してコンピューターに保存するにはどうすればよいですか? これは私がこれまでに得たものです:

NSString *documentsDirectoryPath = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0];

UIImage *imageFromURL = [self getImageFromURL:@"https://www.google.com/images/srpr/logo11w.png"];

[self saveImage:imageFromURL withFileName:@"Google Logo" ofType:@"png" inDirectory:documentsDirectoryPath];

UIImage *imageFromWeb = [self loadImage:@"Google Logo" ofType:@"png" inDirectory:documentsDirectoryPath];

Xcode は UIIMage について不平を言い、NSImage に置き換えようとしています。また、宣言されていない識別子「self」についても文句を言います。

これを実行するには、HTTP 呼び出しも行う必要があります。私が5歳のようにこれを説明してください。

4

2 に答える 2