对于iOS9,ALAssetsLibrary不推荐使用.那么如何改变它PHPPhotoLibrary而不是ALAssets?
if (RecordedSuccessfully && recording == NO) {
//----- RECORDED SUCESSFULLY -----
NSLog(@"didFinishRecordingToOutputFileAtURL - success");
ALAssetsLibrary *library = [[ALAssetsLibrary alloc] init];
if ([library videoAtPathIsCompatibleWithSavedPhotosAlbum:outputFileURL])
{
[library writeVideoAtPathToSavedPhotosAlbum:outputFileURL
completionBlock:^(NSURL *assetURL, NSError *error)
{
if (error)
{
}
}];
}
Run Code Online (Sandbox Code Playgroud)
//我试过这个,但没有用
[[PHPhotoLibrary sharedPhotoLibrary] performChanges:^{
PHAssetChangeRequest* createAssetRequest = [PHAssetChangeRequest creationRequestForAssetFromVideoAtFileURL:outputFileURL];
NSParameterAssert(createAssetRequest);
}
completionHandler:^(BOOL success, NSError *error) {}];
}
}
Run Code Online (Sandbox Code Playgroud) 我正在尝试使用依赖注入而不是跟随单例。这就是我想要达到的目的。当我运行应用程序时,我在此上出现错误"No "decodeObject" candidates produce the expected contextual result type "ModelManager"。知道如何以正确的方式实现依赖注入吗?
我的模特班:
class ModelManager {
var results: MyCustomClass
init(results: MyCustomClass) {
self.results = results
}
func update(customDataInfo: MyCustomClass!) {
self.results = customDataInfo
}
}
Run Code Online (Sandbox Code Playgroud)
MyViewController.swift
class MyViewController: UIViewController {
private let modelManager: ModelManager
init(modelManager: ModelManager) {
self.modelManager = modelManager
super.init(nibName: nil, bundle: nil)
self.modelManager.modelManagerUpdate = self as ModelManagerUpdate
}
required init?(coder aDecoder: NSCoder) {
self. modelManager = aDecoder.decodeObject(value(forKey: "modelManager") as ModelManager)
super.init(coder: aDecoder)
fatalError("init(coder:) has not been implemented")
} …Run Code Online (Sandbox Code Playgroud) 认为我在远程有 50 个提交,在创建合并请求之前,我想删除所有 49 个提交并仅保留我推送的最后一个。
有没有办法做到这一点?
我有 jenkins 文件,它具有 publishHTML 方法来生成带有 jacoco 结果的 .html 文件的报告。是否可以在仪表板上显示该报告,例如“测试趋势结果”?