【发布时间】:2012-02-17 10:13:44
【问题描述】:
如果用户对其照片库进行更改,我这里有一小段代码会更新ALAssetGroup(相册):
- (void) ALAssetsLibraryChangedNotification
{
[[self activityIndicator] startAnimating];
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
[[self library] enumerateGroupsWithTypes:ALAssetsGroupAll usingBlock:^(ALAssetsGroup *group, BOOL *stop)
{
if (group != nil)
{
NSString *newAlbumID = [[NSString alloc] initWithString: [group valueForProperty: ALAssetsGroupPropertyPersistentID]];
if ([newAlbumID isEqualToString: self.albumID])
{
self.album = group;
[self loadPhotos];
[newAlbumID release];
return;
}
[newAlbumID release];
}
}
failureBlock:^(NSError *error)
{
}];
[pool release];
}
它有效,但只是在我得到“signalbrt”和相应的“-[UIButtonContent isEqualToString:]: unrecognized selector sent to instance”之前很长时间(有时UIButtonContent 将改为NSArray)。我还启用了僵尸并收到类似“*** -[CFString release]: message sent to deallocated instance" and "*** -[CFString class]: message sent to deallocated instance”的消息。我尝试过以多种不同的方式分配字符串,但没有一种可以正常工作。有谁知道这里发生了什么?
【问题讨论】:
标签: iphone objective-c ios cocoa-touch memory-leaks