我试图嵌入一个声音静音的视频,但我无法弄清楚它是如何工作的.
目前我正在使用此功能但不起作用:
<iframe src="https://www.youtube.com/embed/uNRGWVJ10gQ?rel=0&autoplay=1" width="560" height="315" frameborder="0" allowfullscreen></iframe>
Run Code Online (Sandbox Code Playgroud)
你们中的任何人都知道我怎样才能做到这一点?
我正在尝试在itunes connect中添加沙盒测试程序.但是我收到了这个错误:
"您输入的电子邮件地址已属于现有的Apple帐户.请重试."
我的问题是,如何在现有的苹果账户中添加砂箱测试仪?
我正在尝试从捆绑目录播放视频,但我收到此错误:
视频[29054:2968406] [MediaRemote] [AVOutputContext]警告:AVF上下文不可用于sharedAudioPresentationContex
这是我的实施:
import UIKit
import AVKit
import AVFoundation
class ViewController: UIViewController {
    var playerVC = AVPlayerViewController()
    var playerView = AVPlayer()
    override func viewDidLoad() {
        super.viewDidLoad()
        self.playVideo()
    }
    func playVideo() {
        let documentsDirectory = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask).last! as NSURL
        guard let fileURL  = documentsDirectory.appendingPathComponent("video.mp4") else{ return }
        self.playerView = AVPlayer(url:fileURL as URL)
        self.playerVC.player = playerView
        self.view.addSubview(self.playerVC.view)
        self.addChildViewController(self.playerVC)
        playerView.play()
    }
Run Code Online (Sandbox Code Playgroud)
你们中的任何人都知道我做错了什么?我真的很感激你的帮助.
我正在尝试构建一个快速的脚本,但我遇到了这个错误:
./1.swift:10:11: error: use of instance member 'thisIsmyFunction' on type 'myScript'; did you mean to use a value of type 'myScript' instead?
 myScript.thisIsmyFunction()
 ~~~~~~~~ ^
Run Code Online (Sandbox Code Playgroud)
这是我的代码:
#!/usr/bin/swift
import Foundation
class myScript {
    func thisIsmyFunction() {
        print("Do something in there!")
    }
}
myScript.thisIsmyFunction()
Run Code Online (Sandbox Code Playgroud)
我要做的是访问该功能并执行打印.
你们中的任何人都知道我做错了什么?
我真的很感谢你的帮助.
我正在尝试从s3存储桶本地复制文件.我可以获取我的存储桶上的文件列表:
aws s3 ls  s3://myBucket/myDirectory/todaysFiles/
Run Code Online (Sandbox Code Playgroud)
但是当我尝试在本地复制文件时:
aws s3 cp s3://myBucket/myDirectory/todaysFiles/ .
Run Code Online (Sandbox Code Playgroud)
我收到此错误:
fatal error: An error occurred (404) when calling the HeadObject operation: Key "myDirectory/todaysFiles/" does not exist
Run Code Online (Sandbox Code Playgroud)
但我尝试在本地复制一个文件:
 aws s3 cp s3://myBucket/myDirectory/todaysFiles/somefile .
Run Code Online (Sandbox Code Playgroud)
我收到此错误:
 warning: Skipping file s3://myBucket/myDirectory/todaysFiles/somefile. Object is of storage class GLACIER. Unable to perform download operations on GLACIER objects. You must restore the object to be able to the perform operation. See aws s3 download help for additional parameter options to ignore or force these transfers. …Run Code Online (Sandbox Code Playgroud) amazon-s3 amazon-web-services aws-cloudformation aws-cli aws-sdk
我试图观察核心数据实例中对象的任何变化。这是我的代码:
class MyClass {
    @objc dynamic var str: String?
}
final class Article: NSObject {
    @objc dynamic var title: String?
    @objc dynamic var summary: String?
    var myVar: MyClass?
}
Run Code Online (Sandbox Code Playgroud)
这是我正在实现的观察者:
func update(article: Article) {
    titleSubscription = article.publisher(for: \.title).sink { value in
        print(value)
    } receiveValue: { _ in
        print("I got something")
    }
    summarySubscription = article.publisher(for: \.myVar?.str).sink{ _ in
        
    } receiveValue: { _ in
        
    }
}
Run Code Online (Sandbox Code Playgroud)
但我收到这个错误:
Thread 1: Fatal error: Could not extract a String from KeyPath Swift.KeyPath<Examples.Article, Swift.Optional<Swift.String>>
Run Code Online (Sandbox Code Playgroud)
你们中有人知道为什么我会收到此错误或者是否有任何解决方法?
我将非常感谢你的帮助。
我有以下功能,我有完成处理程序,但我收到此错误:
Closure use of non-escaping parameter may allow it to escape
Run Code Online (Sandbox Code Playgroud)
这是我的代码:
func makeRequestcompletion(completion:(_ response:Data, _ error:NSError)->Void)  {
    let urlString = URL(string: "http://someUrl.com")
    if let url = urlString {
        let task = URLSession.shared.dataTask(with: url, completionHandler: { (data, urlRequestResponse, error) in
            completion(data, error) // <-- here is I'm getting the error
        })
    task.resume()
    }
}
Run Code Online (Sandbox Code Playgroud)
我真的很感谢你的帮助
我正在尝试保存记录CloudKit但是我从cloudkit中收到以下错误:
error saving record este es error: Error saving record <CKRecordID: 0x7fef15b5d2a0; 2:(_defaultZone:__defaultOwner__)> to server: WRITE operation not permitted
Run Code Online (Sandbox Code Playgroud)
以下是我试图保存记录的方法:
[publicDatabase saveRecord:recordContent completionHandler:^(CKRecord *record, NSError *error){
if (!error)
{
    NSLog(@"saved!!!");
}
else
{
    if ([[error.userInfo valueForKey:@"ErrorDescription"] isEqualToString:@"record to insert already exists"])
    {
        NSLog(@"record already exist %@",[error.userInfo valueForKey:@"ErrorDescription"]);
    }
    NSLog(@"error saving record : %@",error.localizedDescription);
}
}];
Run Code Online (Sandbox Code Playgroud)
但之前我检查过cloudkit是否可用:
[myContainer accountStatusWithCompletionHandler:^(CKAccountStatus accountStatus, NSError *error)
     {
         NSLog(@" no error but status %ld",accountStatus);
         if (((accountStatus == 3) || (accountStatus == 2)) && (!error))
         {
             NSLog(@" …Run Code Online (Sandbox Code Playgroud) 我试图在swift中以编程方式创建一个uitableview,但这里没有加载我的代码:
class ViewController: UIViewController, UITableViewDelegate,UITableViewDataSource {
    var tableView: UITableView  =   UITableView()
    override func viewDidLoad() {
        super.viewDidLoad()
        tableView.delegate      =   self
        tableView.dataSource    =   self
        tableView.registerClass(UITableViewCell.self, forCellReuseIdentifier: "cell")
        self.view.addSubview(self.tableView)
    }
Run Code Online (Sandbox Code Playgroud)
你们中的任何人都知道我错过了什么或我的代码有什么问题?
我真的很感谢你的帮助.