无法使用iCloud存储在网格视图中显示图像?

时间:2013-02-19 11:21:23

标签: iphone ios image icloud

我正在处理图像到iCloud存储。使用我正在实施的this link示例代码。但在这里我使用网格视图来显示图像。对于网格视图,我正在使用AQGridView示例。现在我在实现这个时遇到了一些问题。

我的项目在本地存储中工作正常,但它在iCloud存储中不起作用。将图像添加到网格视图时,只添加了一个视图,但是从视图中删除了该过程的完成,并且我没有得到CloudURL

这里有一些主要代码

    - (void)processiCloudFiles:(NSNotification *)notification {

// Always disable updates while processing results
[_query disableUpdates];

[_iCloudURLs removeAllObjects];

// The query reports all files found, every time.

NSArray * queryResults = [_query results];

for (NSMetadataItem * result in queryResults) {

    NSURL * fileURL = [result valueForAttribute:NSMetadataItemURLKey];

    NSNumber * aBool = nil;

    // Don't include hidden files
    [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);

    // Remove deleted files
    // Iterate backwards because we need to remove items form the array

    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);

    // Add new files
    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];

 }

并且我也显示我的应用程序流程我的应用程序请帮助我

 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.

1 个答案:

答案 0 :(得分:0)

我没有这方面的权威答案,但我肯定会怀疑这是一个时间问题。我希望看到一些代理行动,以了解何时上传iCloud项目。

我还会改进你的日志记录。这条线

NSLog(@"%@",_iCloudURLs);

应该有更好的格式。没有这个,我无法确定,但看起来这条线永远不会到达。