A project needs to study the connection between non-ios devices and ios devices. I learned that Apple's official api does not support this operation, so I began to study Apple's private api.
Many posts have been discussed on cc, but there is no substantial progress.
After some google operations, I successfully enabled the iphone Bluetooth using a private api. Now I want to share my ideas with you.
1. first, go to/Developer/Platforms/iPhoneOS. under the path of platform/Developer/SDKs/iPhoneOS4.3.sdk/System/Library/PrivateFrameworks, find explorthmanager. framework (if I have no estimation, there is only one library file, no header file)
2. manually add the required header file to javasthmanager. framework and create a Headers folder.
3. Create a project and add the same thmanager. framework under the above path to the project.
4. Add the following code to the project. (Note: you do not need to introduce the header file of mongothmanager. Otherwise, a compilation error will occur)
-(Void) startBluetooth {
# If TARGET_IPHONE_SIMULATOR
Exit (EXIT_SUCCESS );
# Else
/* This works in iOS 4.2.3 */
Class effecthmanager = objc_getClass ("effecthmanager ");
Id btCont = [descrithmanager sharedInstance];
[Self defined mselector: @ selector (toggle :) withObject: btCont afterDelay: 1.0f];
# Endif
}
# If TARGET_IPHONE_SIMULATOR
# Else
-(Void) toggle :( id) btCont
{
BOOL currentState = [btCont enabled];
[BtCont setEnabled :! CurrentState];
[BtCont setPowered :! CurrentState];
}
# Endif
5. Compile and run on the real machine, and you will find that the iphone Bluetooth is successfully enabled.
However, unfortunately, all I have studied is to enable Bluetooth. There is no progress in data transmission for device matching.
I hope someone will make persistent efforts to study the methods of device matching and data transmission based on me and share them with you ~