IOS uses privateframework (Private api) to enable Bluetooth tutorial

Source: Internet
Author: User

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 ~

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.