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 關注
- 766 瀏覽
添加回答
舉報
