iOS 代码实现退出当前APP到主界面
做个小笔记避免忘记
OC
[UIApplication sharedApplication] performSelector:@selector(suspend)];
Swift
UIApplication.shared.perform(#selector(NSXPCConnection.suspend))
这篇笔记介绍了如何使用Objective-C和Swift代码来实现从应用内部直接退回到iOS设备的主屏幕。Objective-C中,可以使用`[UIApplication sharedApplication] performSelector:@selector(suspend)]`;而在Swift中,相应的代码是`UIApplication.shared.perform(#selector(NSXPCConnection.suspend))`。这两段代码可以帮助开发者快速将应用暂停并返回到主界面。
iOS 代码实现退出当前APP到主界面
做个小笔记避免忘记
OC
[UIApplication sharedApplication] performSelector:@selector(suspend)];
Swift
UIApplication.shared.perform(#selector(NSXPCConnection.suspend))

被折叠的 条评论
为什么被折叠?