开发者

NSURL may not respond warning +encryptedFileWithPath

开发者 https://www.devze.com 2023-03-31 09:10 出处:网络
I am using the following code which is coming up with a warning. The code does display the correct image - but how can I get rid of the warning?

I am using the following code which is coming up with a warning. The code does display the correct image - but how can I get rid of the warning?

NSString *indexPath = [[NSBundle mainBundle] pathForResource:name ofType:@"png" inDirectory:@"tunes"];
NSURL *url = [NSURL encryptedFileURLWith开发者_如何学GoPath:indexPath];
NSData *data = [NSData dataWithContentsOfURL:url];
UIImage *image = [[UIImage alloc] initWithData:data];

warning 'NSURL may not respond to +encryptedFileWithPath:'


That is because NSURL does not have a method called `encryptedFileWithPath:'. If you have copied your code from here, you probably didn't read the article carefully enough:

If you are familiar with NSURL and its class methods then you may have spotted the unfamiliar encryptedFileURLWithPath: method. I have extended NSURL using a category to add this method as a convenience.

0

精彩评论

暂无评论...
验证码 换一张
取 消