3 回答
TA贡献1875条经验 获得超5个赞
您需要确保二进制文件和头文件都在PrivateFrameworks文件夹下:
/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.2.sdk/System/Library/PrivateFrameworks
这将使您可以将诸如BluetoothManager.framework之类的PrivateFrameworks导入您的应用程序,而不会出错。您可以找到如何在线获取标题。这适用于3.1.2,因为我现在正在编写一个可以在我的设备以及Sim上完美运行的应用程序。
如果要在模拟器中进行测试,请使用以下命令:
#if TARGET_IPHONE_SIMULATOR
//This is where simulator code goes that use private frameworks
#else
/* this works in iOS 4.2.1 */
Class BluetoothManager = objc_getClass("BluetoothManager");
id btCont = [BluetoothManager sharedInstance];
[btCont setPowered:YES];
#endif
TA贡献1834条经验 获得超8个赞
- (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] ;
[self performSelector:@selector(toggle:) withObject:btCont afterDelay:1.0f] ;
#endif
return YES ;
}
#if TARGET_IPHONE_SIMULATOR
#else
- (void)toggle:(id)btCont
{
BOOL currentState = [btCont enabled] ;
[btCont setEnabled:!currentState] ;
[btCont setPowered:!currentState] ;
}
#endif
上述方法将在iOS 4.2.3中工作
- 3 回答
- 0 关注
- 712 浏览
添加回答
举报