gpt4 book ai didi

ios - didReceiveMessage :(XMPPMessage *)message Not Running Actual Device

转载 作者:行者123 更新时间:2023-11-29 11:56:06 27 4
gpt4 key购买 nike

我正在开发一款聊天应用。

- (void)xmppStream:(XMPPStream *)sender didReceiveMessage:(XMPPMessage *)message{}

App is Background

时,此方法有效并在模拟器中运行时捕获购买断点

但在 Real Device App 中的应用程序中运行时

background mode . its not working in background mode

最佳答案

添加以下代码

UIBackgroundTaskIdentifier bgTask = 0;
UIApplication *app = [UIApplication sharedApplication];
bgTask = [app beginBackgroundTaskWithExpirationHandler:^{
[app endBackgroundTask:bgTask];
}];

在你的

- (void)applicationDidEnterBackground:(UIApplication *)application

然后这个方法

- (void)xmppStream:(XMPPStream *)sender didReceiveMessage:(XMPPMessage *)message{}

也将在后台工作。

有关 BackgroundTask 的更多信息,请访问 Documentation

关于ios - didReceiveMessage :(XMPPMessage *)message Not Running Actual Device,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39020100/

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