如果我的AVPlayerItem
状态是.readyToPlay
在运行UI测试时从未到达Travis VM.一切都在当地很好.
我已经设置了简单的repro:
https://travis-ci.org/gsabran/TestAVItemStatus
https://github.com/gsabran/TestAVItemStatus
这使得我的测试在Travis上失败,因为一些事件只有在视频项目准备好播放时才会被触发.
这是我的应用程序(单个视图控制器).基本上它只是加载本地视频并在视频开始播放时更改UI.
override func viewDidLoad() {
super.viewDidLoad()
item = AVPlayerItem(url: URL(fileURLWithPath: Bundle.main.path(forResource: "video", ofType: "mp4")!))
player = AVPlayer(playerItem: item)
item.addObserver(
self,
forKeyPath: #keyPath(AVPlayerItem.status),
options: [.initial, .old, .new],
context: nil)
if player.currentItem?.status == .readyToPlay {
videoDidLoad()
}
player.play()
}
override func observeValue(forKeyPath keyPath: String?,
of object: Any?,
change: [NSKeyValueChangeKey : Any]?,
context: UnsafeMutableRawPointer?) {
guard let item = object as? AVPlayerItem else { return }
if item.status == .readyToPlay {
DispatchQueue.main.async { …
Run Code Online (Sandbox Code Playgroud) 我让jenkins工作为compilate iOS应用程序但我有一个构建失败没有错误:
CodeSign /Users/jenkins/Library/Developer/Xcode/DerivedData/XXXXX.com-aevqskpxrxfoyrgrwjxouvdqwsql/Build/Products/Release-iphoneos/XXXXX.com.app
cd /Users/jenkins/workspaceJenkins/XXXXX.com
setenv CODESIGN_ALLOCATE /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/codesign_allocate
setenv PATH "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
Using code signing identity "iPhone Distribution: XXXXXXX (XXXXX)" and provisioning profile "XXXXX-Jenkins" (XXXXXXXXXXXXXXXXXXXXXXXXXX)
codesign --force --sign XXXXXXXXXXXXXXXXXXXX --resource-rules=/Users/jenkins/Library/Developer/Xcode/DerivedData/XXXXX.com-aevqskpxrxfoyrgrwjxouvdqwsql/Build/Products/Release-iphoneos/XXXXX.com.app/ResourceRules.plist --entitlements /Users/jenkins/Library/Developer/Xcode/DerivedData/XXXXX.com-aevqskpxrxfoyrgrwjxouvdqwsql/Build/Intermediates/XXXXX.com.build/Release-iphoneos/XXXXX.com.build/XXXXX.com.xcent /Users/jenkins/Library/Developer/Xcode/DerivedData/XXXXX.com-aevqskpxrxfoyrgrwjxouvdqwsql/Build/Products/Release-iphoneos/XXXXX.com.app
Validate /Users/jenkins/Library/Developer/Xcode/DerivedData/XXXXX.com-aevqskpxrxfoyrgrwjxouvdqwsql/Build/Products/Release-iphoneos/XXXXX.com.app
cd /Users/jenkins/workspaceJenkins/XXXXX.com
setenv PATH "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
setenv PRODUCT_TYPE com.apple.product-type.application
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/Validation /Users/jenkins/Library/Developer/Xcode/DerivedData/XXXXX.com-aevqskpxrxfoyrgrwjxouvdqwsql/Build/Products/Release-iphoneos/XXXXX.com.app
** BUILD FAILED **
Build step 'Xcode' marked build as failure
Finished: FAILURE
Run Code Online (Sandbox Code Playgroud)
我不明白我有这个错误......