I want to try out the BluetoothManager. But I am really confused after reading and testing all the entries here.
First, I found in
Xcode/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.1.sdk/System/Library/PrivateFrameworks/BluetoothManager.framework
the needed Framework. But there was only the binarie file there. So I add a "Headers" folder and put the BluetoothManager.h file in it.
In my project, I add this framework, but it couldn't find any BluetoothManager.h file, so I get an error, if I use
#import "BluetoothManager.h"
or
#import <BluetoothManager/BluetoothManager.h>
I want to use the following code to start BT:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
// Override point for customization after application launch.
#if TARGET_IPHONE_SIMULATOR
exit( EXIT_SUCCESS ) ;
#else
/* this works in iOS 4.2.3 */
Class BluetoothManager = objc_getClass( "BluetoothManager" ) ;
id btCont = [BluetoothManager sharedInstance] ;
[btCont setPowered:YES] ;
#endif
return YES ;
}
I had tried also all the ideas here:
Has any one a realy good idea, a tutorial or a really running example for using (PrivateFramework/)BluetoothManager to toggle Bluetooth on iPhone, SKD 5.1?
Thank you very much.
isicom
You can generate the header files using class-dump tools from github
Or copy/paste the below content(I generated for IOS 5.1) into BluetoothManager.h and add that file in your project. Then you should not see the error.
Here is a tutorial I wrote: http://www.pocketmagic.net/?p=2827 .
It shows how to configure Xcode with the BluetoothManager framework, then how to use these private apis to turn on/off bluetooth, discover nearby devices or connect to a remote bluetooth device. Tested with iOS 5.1
Let me know if there is anything else I can help you with.