简体   繁体   中英

Core Bluetooth and applicationWillTerminate:

Using Core Bluetooth, two iOS devices have to stay connected to each other (as peripheral and central at the same time) even when the app is in the background. When the user closes the app from the multitasking bar (or the app is killed by the system), I need the devices to cancel the connections to each other (otherwise the bluetooth icon stays white and problems occur...) I see that applicationWillTerminate: isn't called. Is there another way around this?

iOS管理着您应用程序的蓝牙连接,当您的应用程序被杀死并且没有其他应用程序使用相同的共享蓝牙连接时,iOS会自行断开连接。

Any application that doesn't have UIApplicationExitsOnSuspend set in their Info.plist will never have applicationWillTerminate: called. ( Apple documentation on applicationWillTerminate: and on UIApplicationExitsOnSuspend ).

You'll need to find another way to clean up your connections.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM