App push settings for iOS dev WiFi

Source: Internet
Author: User

Sometimes you need to connect to the network during iOS development. When the access request detects that the network is unavailable, you need to prompt the user to manually set up the network and inform the user of the operation path setting available networks.

Just one line of code:

-(void) Viewdidload {

[Super Viewdidload];

UIButton *button = [UIButton buttonwithtype:uibuttontypecustom];

Button.backgroundcolor = [Uicolor Redcolor];

Button.frame = CGRectMake (50, 100, 100, 30);

[Self.view Addsubview:button];

[Button addtarget:self action: @selector (pushsetting) forcontrolevents:uicontroleventtouchupinside];

}

-(void) pushsetting{

Nsurl *url = [Nsurl urlwithstring:@ "Prefs:root=wifi"];

BOOL Iscanopenurl = [[UIApplication sharedapplication] openurl:url];//a line of code to implement the jump

}

Additional: Add the URL types (nsarray) in the Info.plist in the project and select the key in Item0 (nsdictionary) as the URL schemes (nsarray), then set the item0 corresponding to the value prefs. or directly in the info item of the URL types Click + directly set the URL schemes

App push settings for iOS dev WiFi

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.