[英]Why my code won't work on iphone 5
因此,我制作了一個調用數字的應用程序:
NSString *cleanedString = [[number componentsSeparatedByCharactersInSet:[[NSCharacterSet characterSetWithCharactersInString:@"0123456789-+()"] invertedSet]] componentsJoinedByString:@""];
NSString *escapedPhoneNumber = [cleanedString stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
NSURL *telURL = [NSURL URLWithString:[NSString stringWithFormat:@"tel://%@", escapedPhoneNumber]];
UIWebView *mCallWebview = [[UIWebView alloc] init] ;
[self.view addSubview:mCallWebview];
[mCallWebview loadRequest:[NSURLRequest requestWithURL:telURL]];
但是,使用iPhone 5的測試人員報告說,在使用Main時,它不能在手機上正常工作。 他沒有撞車或其他任何事情。
感謝你!
NSString *number = YOUR-NUMBER;
NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@"telprompt:%@",number]];
[[UIApplication sharedApplication] openURL:url];
嘗試使用此代碼,通話結束后它將導航回到您的應用
tel:
URL模式在您的代碼中使用不正確,請刪除//
NSURL *telURL = [NSURL URLWithString:[NSString stringWithFormat:@"tel:%@", escapedPhoneNumber]];
您可以檢查此代碼。希望對您有所幫助。
NSString *phoneNo = @"your phone no";
NSString *strAppend = [@"tel:" stringByAppendingString:phoneNo];
[[UIApplication sharedApplication]
openURL:[NSURL URLWithString:strAppend]];
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.