welcome to linkAR technical documentation

previous

Adding Poster Images:

- (void)handleNotification:(NSNotification*)note {
    ...
    //1
    if (myDate == nil || ([currentDate timeIntervalSinceDate:myDate]/360 >= 24) || mainController.updateMovies) {
        ...
 
        //2
        resultAdd = [_cvView addImage:[UIImage imageWithData:posterdat] withUniqeID:[NSNumber numberWithInt:movieId]];
 
        //3
        if(resultAdd != -1){
            //4.- Saves the movie into NSDocumentDirectory and adds it into an array.
            [mainController.moviesHandler writeFiles:auxDictionary];
        }
    }else{
        //2
        resultAdd = [_cvView addImage:((Movie*)note.object).posterImage withUniqeID:[NSNumber numberWithInt:((Movie*)note.object).movieId]];
        //3
        if(resultAdd != -1){
            //4.- Adds the movie into an array.
            [mainController.moviesHandler insertObject:((Movie*)note.object)];
        }
    }
}
  1. It distinguishes between the movie has been downloaded or if the movie has been reloaded from NSDocumentDirectory:
    1. If the movie has been downloaded, the function gets the poster image from a NSDictionary (objectForKey:@”poster_path”).
    2. If the movie has been reloaded, the function get the poster image from the object that received ([notification object]).
  2. We add the image into te library. It is important to assign the returned value into a variable.
  3. If the returned value is not (-1), the the image was added into the pool. If the value is (-1), then the image does not have the library quality requirements.
  4. If the image was added into the pool, the function calls other function to save the movie into NSDocumentDirectory (only if the movie has been downloaded) and add it into an array.

previous