Monika Patel
Monika Patel

Reputation: 2375

Unable to assign image url to MWPhoto in iOS

In my application used https://github.com/mwaterfall/MWPhotoBrowser library .. But i unable to assign image url how can i assign image url. please resolved my problem Please check my code :

 -(NSUInteger)numberOfPhotosInPhotoBrowser:(MWPhotoBrowser *)photoBrowser
{
    return _photos.count;
}

- (MWPhoto *)photoBrowser:(MWPhotoBrowser *)photoBrowser photoAtIndex:(NSUInteger)index
{
    if (index < _photos.count)
        return [_photos objectAtIndex:index];    return nil;
}


- (void)viewDidLoad
{
    [super viewDidLoad];
    NSMutableArray *photos = [[NSMutableArray alloc] init];

   // photos=[[NSMutableArray alloc]initWithObjects:@"1.jpg",@"2.jpg",@"3.png", nil];
    photos=[[NSMutableArray alloc]initWithObjects:@"http://www.google.co.in/imgres?imgurl=https://alaskabibleteacher.files.wordpress.com/2014/09/apple-tree.jpg&imgrefurl=http://brokenbelievers.com/2014/09/19/the-apple-tree/&h=606&w=808&tbnid=uY1OY_HyQ8hE1M:&docid=vKsOHUHBZ2CVFM&ei=1mXuVcu1O8rbuQTW_7Z4&tbm=isch&ved=0CDEQMygBMAFqFQoTCMv4zcvO5scCFcptjgod1r8NDw",@"http://www.apple.com/ipad/home/images/social/og.jpg?201508031746", nil];
    for (int i = 0; i < photos.count; i++)
    {
        [photos addObject:[MWPhoto photoWithURL:[NSURL URLWithString:photos[i]]]];
    }
    _photos = photos;
    MWPhotoBrowser *browser = [[MWPhotoBrowser alloc] initWithDelegate:self];
    UINavigationController *nc = [[UINavigationController alloc]     initWithRootViewController:browser];
    [browser showNextPhotoAnimated:YES];
    [browser showPreviousPhotoAnimated:YES];
    [self presentViewController:nc animated:YES completion:nil];

}

i updated my code and error... I got an error : [MWPhoto length]: unrecognized selector sent to instance 0x7febf97f4740 2015-09-08 10:43:16.231 Salon[3926:66068] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[MWPhoto length]: unrecognized selector sent to instance 0x7febf97f4740'

Upvotes: 0

Views: 118

Answers (1)

Anbu.Karthik
Anbu.Karthik

Reputation: 82769

add -ObjC, -all_load in your Other linker Flags and check , if already available then remove the above flags in Build settings.

additional reference

Upvotes: 1

Related Questions