在单独的线程中创建SceneKit对象时iOS Swift内存泄漏
如果创建新的单视图应用程序,请添加一个UIButton,并为其提供以下iAction:在单独的线程中创建SceneKit对象时iOS Swift内存泄漏,ios,swift,multithreading,scenekit,Ios,Swift,Multithreading,Scenekit,如果创建新的单视图应用程序,请添加一个UIButton,并为其提供以下iAction: import UIKit import SceneKit class ViewController: UIViewController { @IBAction func trigger(_ sender: UIButton) { DispatchQueue.global(qos: .userInteractive).async { for _ in 0..&l
import UIKit
import SceneKit
class ViewController: UIViewController {
@IBAction func trigger(_ sender: UIButton) {
DispatchQueue.global(qos: .userInteractive).async {
for _ in 0..<100000 {
SCNSphere(radius: 100)
}
}
}
}
导入UIKit
导入SceneKit
类ViewController:UIViewController{
@iAction func触发器(uSender:ui按钮){
DispatchQueue.global(qos:.userInteractive).async{
对于0中的uu..尝试将循环放入autoreleasepool{}
。我尝试了autoreleasepool
,但没有任何影响。尝试将循环放入autoreleasepool{}
。我尝试了autoreleasepool
,但没有任何影响。