gpt4 book ai didi

iOS4 UIImagePickerController 不支持 mediaTypes = [NSArray arrayWithObject :(NSString *) kUTTypeMovie]?

转载 作者:可可西里 更新时间:2023-11-01 03:57:37 25 4
gpt4 key购买 nike

在我的应用中,我想在视频模式下打开相机,所以我写了下面的代码


- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
[window addSubview:viewController.view];
[window makeKeyAndVisible];

UIImagePickerController *ipc;
ipc = [[UIImagePickerController alloc] init];
ipc.sourceType = UIImagePickerControllerSourceTypeCamera;
ipc.mediaTypes = [NSArray arrayWithObject:(NSString *) kUTTypeMovie];

[viewController presentModalViewController:ipc animated:YES];

return YES;
}

此代码适用于 iPhone 3.1.3,但在 iOS4 上不起作用。我可以在 iOS4 上将 UIImagePickerController 用作视频吗?

最佳答案

我是 iphone develop 的新手,但我遇到了同样的问题,我通过这样设置 mediaTypes 解决了这个问题

NSArray* mediaTypes = [UIImagePickerController availableMediaTypesForSourceType:UIImagePickerControllerSourceTypeCamera]
ipc.mediaTypes = mediaTypes;

这允许您访问视频和照片,我希望这对您有帮助

关于iOS4 UIImagePickerController 不支持 mediaTypes = [NSArray arrayWithObject :(NSString *) kUTTypeMovie]?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3093216/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com