gpt4 book ai didi

ios - UIImageWriteToSavedPhotosAlbum 阻塞主线程

转载 作者:行者123 更新时间:2023-11-28 23:09:55 32 4
gpt4 key购买 nike

我目前认识到

第一个函数调用
   UIImageWriteToSavedPhotosAlbum

阻塞主线程大约 1.5 秒,即使在 iphone 4s/ipad2 上也是如此。

我也试过像这样将它保存在一个单独的线程中:

-(void) storeInBackground
{
NSAutoreleasePool *p = [NSAutoreleasePool new];
UIImageWriteToSavedPhotosAlbum(imageView.image, nil,nil,nil);
[p release];
}

....

//call
NSThread* thread1 = [[NSThread alloc] initWithTarget:self
selector:@selector(storeInBackground)
object:nil];
[thread1 setThreadPriority:0.1];
[thread1 start];
[thread1 release];

但是,一切都被阻止了。一旦它挖到相册后,它的速度就像瞬间一样。

有什么线索可以在这里做什么吗?

谢谢!

最佳答案

好的 - 拔下电缆就可以了!使用 Xcode 运行会减慢它的速度,使用没有调试的应用程序会像预期的那样快。

关于ios - UIImageWriteToSavedPhotosAlbum 阻塞主线程,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8565313/

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