假设我们有两个视频资源(AVAsset对象),让我们把它们称为空白和主要,其中main是一个随机有限长度的视频,比方说2-5分钟,而空白总是4秒视频,我们要合并视频按以下顺序排列:
空白 - 主要 - 空白
// Create AVMutableComposition Object.This object will hold our multiple AVMutableCompositionTrack.
let mixComposition = AVMutableComposition()
let assets = [blank, main, blank]
var totalTime : CMTime = CMTimeMake(0, 0)
var atTimeM: CMTime = CMTimeMake(0, 0)
Utils.log([blank.duration, main.duration])
// VIDEO TRACK
let videoTrack = mixComposition.addMutableTrack(withMediaType: AVMediaTypeVideo, preferredTrackID: Int32(kCMPersistentTrackID_Invalid))
for (index,asset) in assets.enumerated() {
do {
if index == 0 {
atTimeM = kCMTimeZero
} else {
atTimeM = totalTime …Run Code Online (Sandbox Code Playgroud) 我正在开发一个将使用两个身份验证提供程序的应用程序:
对于前者,我没有任何问题,一切都按预期工作.但是,在使用Cognito用户池设置身份验证时,我正在接着一个墙.我使用的是AWS SDK 2.4.9,XCode 8和Swift 3.
我知道已经有很多问题已经被提出,并且有很多"指南".但是,很多人都会回答/制作过时的文档和SDK.甚至官方AWS文档也已过时.
我要经历的身份验证步骤如下:
1.配置初始认知池
/// Set the default service configuration
let serviceConfiguration = AWSServiceConfiguration(region: AWSRegionType.usEast1, credentialsProvider: nil)
AWSServiceManager.default().defaultServiceConfiguration = serviceConfiguration
/// Create a pool configuration and register it for a specific key to use later
let poolConfiguration = AWSCognitoIdentityUserPoolConfiguration(clientId: appClientID, clientSecret: appClientSecret, poolId: poolID)
AWSCognitoIdentityUserPool.registerCognitoIdentityUserPool(with: poolConfiguration, forKey: poolKey)
/// Create a pool for a specific predefined key
pool = AWSCognitoIdentityUserPool(forKey: poolKey)
Run Code Online (Sandbox Code Playgroud)
2.针对Cognito用户池验证用户
user.getSession(username, password: password, validationData: nil).continue({ (task) -> AnyObject? in
if let …Run Code Online (Sandbox Code Playgroud) 我根据CocoaPods网站上的说明创建了一个新的pod组件.现在我的Pods中有以下结构:
豆荚(文件夹)
MyComponent(文件夹)
MyComponent.swift
资源(文件夹)
- name_of_image.png
但是,当我试着打电话时:
UIImage(named: “name_of_image”)
Run Code Online (Sandbox Code Playgroud)
从MyComponent.swift,我得到一个"零"回报.
我已经阅读了包括为我的组件创建一个包的解决方案,但我还没有找到一种自己生成它的正确方法.任何建议都会很好.
谢谢
我一直在尝试设置一个Web视图包装器应用程序,它将加载一个网站的内容(仍然要启动).目前,该网站处于开发模式,该网站的唯一端点受到http身份验证的保护.
我一直在寻找这个解决方案:Swift webview xcode发布数据
但是,我不想每次都发出一个POST请求,但我宁愿一次对网站进行身份验证并保持连接.
我正在寻找的是一个干净稳定的解决方案,这个解决方案可以让我能够控制边缘情况,例如提供的错误凭据.
我不习惯使用NSURLConnection,因为在iOS9中不推荐使用该解决方案.我需要一个NSURLSession的解决方案.
如果我在上述链接解决方案中缺少某些内容,请告诉我.我相信有人也有这个问题.此外,该网站还具有SSL保护.
亲切的问候