NSURL may not respond warning +encryptedFileWithPath
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.
精彩评论