亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

以編程方式在iPhone SDK中打開藍牙?

以編程方式在iPhone SDK中打開藍牙?

白衣染霜花 2019-10-09 17:52:28
我已經看到很多與此有關的問題,但是沒有人真正給出真正的答案(要導入的框架,實際代碼等)。他們只會說一個私有的api,這會使您的應用程序被應用程序商店拒絕。我知道使用私有api將使我的應用程序被拒絕,因為我想知道如何將其用于個人使用。(iPhone SDK 3.1.2,iPod touch 2g)
查看完整描述

3 回答

?
慕田峪4524236

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


查看完整回答
反對 回復 2019-10-09
?
MMMHUHU

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中工作


查看完整回答
反對 回復 2019-10-09
  • 3 回答
  • 0 關注
  • 766 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號