简体   繁体   English

当应用程序在我的设备(iPhone 6)上快速运行时,“没有可用的源1类型”

[英]'No available types for source 1' when the app runs on my device(IPhone 6) swift

This all of a sudden,but when I run the following method it throws a 'No available types for source 1' Error, I've looked every where and people say its cuz its in a simulator well I'm running it on my iPhone 6. any clue why? 这突然之间,但是当我运行以下方法时,它会抛出“没有可用的源1类型”错误,我看了每个地方,人们说它在模拟器中很好我在iPhone上运行它6.任何线索为什么?

func captureVideo(){
    if(UIImagePickerController.isSourceTypeAvailable(UIImagePickerControllerSourceType.Camera)){
    var date = NSDate()


    var picker = UIImagePickerController()


    picker.delegate = self
    picker.allowsEditing = true;
    picker.sourceType = UIImagePickerControllerSourceType.Camera
    picker.mediaTypes = NSArray(objects: kUTTypeVideo)
    var interval = NSTimeInterval(30)
    picker.videoMaximumDuration = interval
    picker.showsCameraControls = true;

    self.presentViewController(picker, animated: true, completion: nil)

    }

}

Probably the issue is with: 可能问题在于:

picker.mediaTypes = NSArray(objects: kUTTypeVideo)

Change it to: 将其更改为:

picker.mediaTypes = NSArray(objects: kUTTypeMovie)

For video recording use kUTTypeMovie not kUTTypeVideo . 对于视频录制,使用kUTTypeMovie而不是kUTTypeVideo


According to UIImagePickerController mediaTypes : 根据UIImagePickerController mediaTypes

If you set this property to an empty array, or to an array in which none of the media types is available for the current source, the system throws an exception. 如果将此属性设置为空数组,或者将当前源中没有任何媒体类型可用的数组设置为系统,则系统会引发异常。

It is better to use availableMediaTypesForSourceType: before assigning any value to mediaTypes. 在为mediaTypes分配任何值之前,最好使用availableMediaTypesForSourceType : .

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 iPhone应用程序永远不会在设备上运行 - iphone app never runs on device 为什么当我从 Swift 中的同一部 iPhone 中删除应用程序时,我的唯一设备 ID 会发生变化? - Why is my unique device ID changing when I delete the app from the same iPhone in Swift? 在iPhone6设备上运行我的应用程序时出现错误 - Error appeared when running my App on iPhone6 device 当我最小化iPhone中的任何应用程序时,该应用程序是否在后台运行? 或暂停? 或停止应用程序? - When i minimise any app in my iPhone Does that app runs in background? or Pauses? or stops the app ? 为什么我的iPhone应用程序在iPad上全屏运行 - Why my iPhone app runs in fullscreen on iPad 当应用程序在其他设备上运行时,如何使对象适应其他大小。 (迅速) - How to make an object adapt to another size when the app runs in another device. (swift) 在横向启动我的 Swift 应用程序时设备屏幕宽度错误 - Device screen width wrong when starting my Swift app in landscape iOS应用程序在iPhone5s上以iPhone4分辨率运行吗? - iOS app runs at iPhone4 resolution on my iPhone5s? Swift:如何检查我的应用是否具有WLAN权限并且设备是否已连接到WIFI源? - Swift: How to check if my app has WLAN permission and the device is connected to a WIFI source? Swift:应用程序在模拟器中运行良好,但在实际的iPhone上崩溃了吗? - Swift: app runs well in simulator but crashes on actual iPhone?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM