已实现Xcode 4.0.2
iPhone4 iOS 4.3.5
CoreLocation 和 MobileCoreServices 框架。
进口的MobileCoreServices/UTCoreTypes.h
- (void) displayVideoPicker
{
UIImagePickerController *ipc = [[UIImagePickerController alloc] init];
ipc.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
ipc.mediaTypes = [[NSArray alloc] initWithObjects: (NSString *) kUTTypeMovie, nil];
ipc.videoMaximumDuration = 45.0f;
ipc.videoQuality = UIImagePickerControllerQualityTypeMedium;
ipc.delegate = self;
[self presentModalViewController:ipc animated:YES];
[ipc release];
}
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
{
[[picker parentViewController] dismissModalViewControllerAnimated: YES];
}
NSCFNumber
Instruments 在可能的 Frame上报告了 16 字节的小泄漏FigRemote_CreatePropertyListFromBinaryPListData
:
Leaked Object # Address Size 责任库责任框架 NSCFNumber,8 128 Bytes MediaToolbox FigRemote_CreatePropertyListFromBinaryPListData
如果我删除这条线,泄漏就会消失:
ipc.mediaTypes = [[NSArray alloc] initWithObjects: (NSString *) kUTTypeMovie, nil];
我已经尝试过了,但它并没有消除泄漏。
NSArray *myMediaTypes = [[NSArray alloc] initWithObjects: (NSString *) kUTTypeMovie, nil];
ipc.mediaTypes = myMediaTypes;
[myMediaTypes release];
泄漏发生在选择视频并返回初始视图之后。有什么想法吗?