Created
September 3, 2014 11:11
-
-
Save kioqq/c6006fb36c83f0334259 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (NSURL *) checkURLonImage :(NSString *) artworkStringURL { | |
// make strings | |
NSString *artwork600 = [artworkStringURL stringByReplacingOccurrencesOfString:@"100x100-75" | |
withString:@"600x600-75"]; | |
NSString *artwork400 = [artworkStringURL stringByReplacingOccurrencesOfString:@"100x100-75" | |
withString:@"400x400-75"]; | |
// urls | |
NSURL *urlFor600 = [NSURL URLWithString:artwork600]; | |
NSURL *urlFor400 = [NSURL URLWithString:artwork400]; | |
// data | |
NSData *data600 = [NSData dataWithContentsOfURL:urlFor600]; | |
NSData *data400 = [NSData dataWithContentsOfURL:urlFor400]; | |
if (data600 != nil) { | |
return urlFor600; | |
} | |
else if (data400 != nil) | |
{ | |
return urlFor400; | |
} | |
else | |
{ | |
return nil; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment