gpt4 book ai didi

iOS - Swift 我怎么知道 copyItemAtPath 何时完成?

转载 作者:可可西里 更新时间:2023-11-01 02:16:39 25 4
gpt4 key购买 nike

我想在开始时创建预种子数据库该文件非常大 (5mb)。

我使用copyItemAtPath来复制文件,请问这个方法有补全吗?我怎么知道这个过程何时完成?

最佳答案

这段代码就够了:

do {
// copy files from main bundle to documents directory
print("copy")
try
NSFileManager.defaultManager().copyItemAtPath(sourcePath, toPath: destinationPath)
} catch let error as NSError {
// Catch fires here, with an NSError being thrown
print("error occurred, here are the details:\n \(error)")
}

destinationPath 可以是例如:

NSSearchPathForDirectoriesInDomains(NSSearchPathDirectory.DocumentDirectory, .UserDomainMask, true).first

关于iOS - Swift 我怎么知道 copyItemAtPath 何时完成?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37701427/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com