0

我有一个简单的 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)并将其与关联的 appc.js 一起添加到 src 目录中。但是每次应用程序编译时,我都会进行 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

我做错了什么以及有关如何纠正问题的任何建议?

4

1 回答 1

0

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

于 2016-10-31T12:49:53.313 回答