Hyperloop Swift Generation因未知或不支持类型而失败(AVCaptureSession)

时间:2016-10-30 15:44:54

标签: ios swift appcelerator appcelerator-hyperloop

我有一个简单的Swift类,它在使用它创建的XCode 8.1项目中运行良好(类中有更多,但为了简洁起见,该示例已被删除)。

import UIKit
import AVFoundation

public class ExampleView: UIView {

   let captureSession = AVCaptureSession()
   var previewLayer : AVCaptureVideoPreviewLayer?

   override init (frame : CGRect) {
      super.init(frame : frame)
   }

   convenience init () {
      self.init(frame:CGRect.zero)
   }

   required public init(coder aDecoder: NSCoder) {
      fatalError("This class does not support NSCoding")
   }

   func doSomething(){
      print("do something here.....")
   }
}

用于viewDidLoad()

let example = ExampleView(frame: self.view.layer.frame);
example.doSomething()

我创建了新的Hyperloop iOS项目(SDK 5.5.1.GA)并将其添加到src目录以及相关的appc.js.但每次应用程序编译时,我都会进行Hyperloop编译,并且失败并显示以下内容

[TRACE] :  [Hyperloop] metabase took 2243 ms to generate
2016-10-30T15:39:31.675Z | ERROR  | An uncaught exception was thrown!
Cannot read property '1' of null
2016-10-30T15:39:31.676Z | ERROR  | Cannot read property '1' of null

所以我尝试将此文件添加到 hyperloop-examples 项目的 src 目录中,但这也给了我以下错误

[TRACE] :  [Hyperloop] metabase took 2425 ms to generate
Swift Generation failed with unknown or unsupported type (AVCaptureSession)     found while compiling /Users/accountone/hyperloop-examples/src/MyExample.swift

我做错了什么以及有关如何解决问题的建议?

1 个答案:

答案 0 :(得分:0)

您是否已将AVFoundation框架添加到appc.js文件中?