gpt4 book ai didi

ios - EKEventStore编程Xcode iOS异步搜索

转载 作者:行者123 更新时间:2023-11-29 02:30:02 24 4
gpt4 key购买 nike

文档指出:

  • (void)enumerateEventsMatchingPredicate:(NSPredicate *)predicate usingBlock:(EKEventSearchCallback)block

This method is synchronous. For asynchronous behavior, run the method on another thread with dispatch_async or NSOperation.

如何使这个异步,句子并没有真正演示它。谁能解释一下吗?

谢谢

D:-)

最佳答案

要么全部发送:

#include <stdio.h>

int main(int argc, char *argv[]) {
...
dispatch_async(dispatch_get_global_queue(0,0), ^{
[store enumerateEventsMatchingPredicate:p usingBlock:^(..) {
//DO IT
}];
});
...
}

或回调

#include <stdio.h>

int main(int argc, char *argv[]) {
...
[store enumerateEventsMatchingPredicate:p usingBlock:^(..) {
dispatch_async(dispatch_get_global_queue(0,0), ^{
//DO IT
});
}];

...
}

关于ios - EKEventStore编程Xcode iOS异步搜索,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27024816/

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