dataWithContentsOfURL:
Returns a data object containing the data from the location specified by a given URL.
+ (id)dataWithContentsOfURL:(NSURL *)aURL
Parameters
- aURL
- The URL from which to read data.
Return Value of [NSData dataWithContentsOfURL]
A data object containing the data from the location specified by aURL. Returns
nil
if the data object could not be created.Discussion
If you need to know what was the reason for failure, use
dataWithContentsOfURL :options:error:
.
Example of [NSData dataWithContentsOfURL]
NSError* error = nil;
NSData* data = [NSData dataWithContentsOfURL:yourURL options:NSDataReadingUncached error:&error];
if (error) {
NSLog(@"%@", [error localizedDescription]);
[error release];
} else {
NSLog(@"Data has loaded successfully.");
}