Just My Life & My Work

Archive for 2016 年 12 月 30 日

[iOS] 導向系統設定App

有些功能只能從系統設定App,那麼我們就必須知會使用者,若可以的話就導向系統設定App吧~

iOS 系統設定app 垃圾管家.jpg

/**
 Theme: Open Setting App
 IDE: Xcode 8
 Language: Objective C
 Date: 105/12/28
 Author: HappyMan
 Blog: https://cg2010studio.wordpress.com/
 */
-(void)pushSettingAction:(id)sender
{
    if (/* DISABLES CODE */ (&UIApplicationOpenSettingsURLString) != nil) {
        [[UIApplication sharedApplication] openURL:[NSURL URLWithString:UIApplicationOpenSettingsURLString]];
    }
    else {
        DxLog(@"UIApplicationOpenSettingsURLString is not available in current iOS version");
    }
}

這樣我就能導向原本App(以垃圾管家為例)的系統設定囉~

參考:How to open Settings programmatically like in Facebook app?

標籤雲

%d 位部落客按了讚: