I am developing an application for iPhone using the SDK 4.1 focused on iOS 4.1 or later.
The tools report memory leaks for the code below.
void (^resultBlock)(ALAsset *) = ^(ALAsset *asset) {
NSLog(@"resultBlock");
};
void (^failureBlock)(NSError *) = ^(NSError *error) {
NSLog(@"error");
};
NSURL *url = [NSURL URLWithString:@"assets-library://asset/asset.JPG?id=1000000176&ext=JPG"];
ALAssetsLibrary *library = [[ALAssetsLibrary alloc] init];
[library assetForURL:url resultBlock:resultBlock failureBlock:failureBlock];
[library release];
I just put this code in the viewDidLoad of my TestApp for the test. (I use with UIImagePicker in my actual project.)
When I run TestApp with a tool (leak), it reports a memory leak about 10 seconds after starting.
Can someone tell me what is wrong with this code, or is there something else that I should do?
Thank.
source
share