我有一个简单的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.....")
}
}
And在viewDidLoad()
中使用let example = ExampleView(frame: self.view.layer.frame);
example.doSomething()
我创建了新的Hyperloop iOS项目(SDK 5.5.1.GA),并将其与关联的app .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
我做错了什么,对如何纠正问题有什么建议吗?
是否已将AVFoundation
框架添加到appc.js
文件中?