Following is my Method for uploading video on background thread reading from plist file .
Now what i need is once they read all the entry from plist and done execution of first block i want to check in completion block that is there any new entry came in plist file..and if not just call startThreadForUpload
after few time.so can any one suggest me how can i do that? right now i just calling same method in completion block so it keeps on runnning...
-(void)startThreadForUpload{
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
assetManager =[AssetManager sharedInstance];
NSDictionary *videoListDict= [assetManager getAllVideoFromPlist];
NSArray *videoListKeyArray=[videoListDict allKeys];
if(videoListKeyArray.count!=0)
{
for(NSString *key in videoListKeyArray){
NSData *videoData = [videoListDict objectForKey:key];
Video *vidObject = (Video *)[NSKeyedUnarchiver unarchiveObjectWithData:videoData];
amazonManger=[AmazonManager sharedInstance];
[amazonManger uploadVideoWithVideoName:vidObject.videoName IsImage:NO VideoObject:vidObject];
[amazonManger uploadVideoWithVideoName:vidObject.thumbImageName IsImage:YES VideoObject:vidObject];
}
}
dispatch_async(dispatch_get_main_queue(), ^(void) {
//Stop your activity indicator or anything else with the GUI
//Code here is run on the main thread
[self startThreadForUpload];
// WARNING! - Don't update user interfaces from a background thread.
});
});
}