I work with images in iCloud storage. using this link is an example of the code that I am implementing. but here I use a grid to show images. for grid view I am using AQGridViewSample. I now had a problem implementing this.
my project works fine in local storage but doesn't work in storage iCloud. while adding an image to the grid, only one view was added, but the completion of the process that it removed from the view, as well, I did not receive CloudURL.
here is some basic code
- (void)processiCloudFiles:(NSNotification *)notification {
[_query disableUpdates];
[_iCloudURLs removeAllObjects];
NSArray * queryResults = [_query results];
for (NSMetadataItem * result in queryResults) {
NSURL * fileURL = [result valueForAttribute:NSMetadataItemURLKey];
NSNumber * aBool = nil;
[fileURL getResourceValue:&aBool forKey:NSURLIsHiddenKey error:nil];
if (aBool && ![aBool boolValue]) {
[_iCloudURLs addObject:fileURL];
NSLog(@"%@",_iCloudURLs);
}
}
NSLog(@"Found %d iCloud files.", _iCloudURLs.count);
_iCloudURLsReady = YES;
if ([self iCloudOn]) {
NSLog(@"%d",_objects.count);
for (int i = _objects.count -1; i >= 0; --i) {
PTKEntry * entry = [_objects objectAtIndex:i];
if (![_iCloudURLs containsObject:entry.fileURL]) {
[self removeEntryWithURL:entry.fileURL];
}
}
NSLog(@"%@",_iCloudURLs);
for (NSURL * fileURL in _iCloudURLs) {
[self loadDocAtURL:fileURL];
}
self.navigationItem.rightBarButtonItem.enabled = YES;
}
if (_moveLocalToiCloud) {
_moveLocalToiCloud = NO;
[self localToiCloudImpl];
}
else if (_copyiCloudToLocal) {
_copyiCloudToLocal = NO;
[self iCloudToLocalImpl];
}
[_query enableUpdates];
}
and also I will show my console stream of my application, please help me
2013-02-19 13:29:26.159 XXXX[337:907] iCloud available at: file://localhost/private/var/mobile/Library/Mobile%20Documents/XXXXX~com~XXXX~XXXX/
2013-02-19 13:29:32.847 XXXX[337:907] No longer watching iCloud dir...
2013-02-19 13:29:32.849 XXXX[337:907] Starting to watch iCloud dir...
2013-02-19 13:29:33.002 XXXX[337:907] Found 0 iCloud files.
2013-02-19 13:29:33.004 XXXX[337:907] local => iCloud impl
2013-02-19 13:29:38.697 XXXX[337:907] Want to create file at file://localhost/private/var/mobile/Library/Mobile%20Documents/XXXX~com~XXXX~XXXX/Documents/iBoast_Art_Soodu.ibt
2013-02-19 13:29:38.781 XXXX[337:907] File created at file://localhost/private/var/mobile/Library/Mobile%20Documents/XXXX~com~XXXX~XXXX/Documents/iBoast_Art_Soodu.ibt
2013-02-19 13:29:38.790 XXXX[337:907] load table
2013-02-19 13:30:38.563 XXXX[337:907] button index: 1
2013-02-19 13:30:41.595 XXXX[337:907] iCloud available at: file://localhost/private/var/mobile/Library/Mobile%20Documents/XXXX~com~XXXX~XXXX/
2013-02-19 13:30:41.607 XXXX[337:907] No longer watching iCloud dir...
2013-02-19 13:30:41.612 XXXX[337:907] Starting to watch iCloud dir...
2013-02-19 13:30:41.780 XXXX[337:907] Success to close file://localhost/private/var/mobile/Library/Mobile%20Documents/XXXX~com~XXXX~XXXX/Documents/iBoast_Art_Soodu.ibt
2013-02-19 13:30:41.790 XXXX[337:907] load table
2013-02-19 13:30:42.011 XXXX[337:907] Found 0 iCloud files.
Vijay