objective c - transition between is and iOS 8 using NSString imageURL -
new ios development,
app worked fine in ios 7 upon release of ios 8, app wouldn't open, set breakpoit led me home screen , line. appears there issue pulling image url correct. xcode output - uiimageview setimagewithurl:placeholderimage:]: im struggling find solve it
[cell.imagelabel setimagewithurl:[nsurl urlwithstring:imageurl]
here bit more code setting data
nsdatecomponents *components = [[nscalendar currentcalendar] components:nsdaycalendarunit | nsmonthcalendarunit | nsyearcalendarunit fromdate:[nsdate date]]; nsinteger month = [components month]; nsinteger year = [components year]; _images = @[[nsstring stringwithformat:@"http://w***.jpg?month=%i&year=%i", month, year], [nsstring stringwithformat:@"http://***.jpg?month=%i&year=%i", month, year], [nsstring stringwithformat:@"http://***.jpg?month=%i&year=%i", month, year], [nsstring stringwithformat:@"http://***.jpg?month=%i&year=%i", month, year], [nsstring stringwithformat:@"http://***.jpg?month=%i&year=%i", month, year], [nsstring stringwithformat:@"http://***.jpg?month=%i&year=%i", month, year], @"television.png"];
this code configure cell:
// configure cell...
int row = [indexpath row]; cell.titlelabel.text = _title[row]; cell.desclabel.text = _description[row]; nsstring *imageurl = _images[row]; if(row < 6){ [cell.imagelabel setimagewithurl:[nsurl urlwithstring:imageurl] placeholderimage:[uiimage imagenamed:@"loading.png"]]; } else { cell.imagelabel.image = [uiimage imagenamed:_images[row]]; } return cell;
i think following code you,
int row = [indexpath row]; cell.titlelabel.text = _title[row]; cell.desclabel.text = _description[row]; nsstring *stringurl = _images[row]; nsurl *urlstr = [nsurl urlwithstring:stringurl]; alassetslibrary *library = [[alassetslibrary alloc] init]; [library assetforurl:urlstr resultblock:^(alasset *asset) { __block uiimage *assetthumbnailimage = [uiimage imagewithcgimage:asset]; dispatch_queue_t queue = dispatch_get_global_queue(dispatch_queue_priority_high, 0ul); dispatch_async(queue, ^{ uiimage *image = assetthumbnailimage; assetthumbnailimage = nil; dispatch_sync(dispatch_get_main_queue(), ^{ cell.imagelabel.image = image; }); }); } failureblock:^(nserror *error) { // error handling nslog(@"failure-----"); }];
Comments
Post a Comment