2011-11-14 30 views
0
NSString *phoneStr = [[NSString alloc] initWithFormat:@"tel:%@",phone_number]; 
NSURL *phoneURL = [[NSURL alloc] initWithString:phoneStr]; 
[[UIApplication sharedApplication] openURL:phoneURL]; 
[phoneURL release]; 
[phoneStr release]; 

NSString *phoneStr = [[NSString alloc] initWithFormat:@"tel:*12*%@",phone_number]; 

我試圖讓應用爲iPhone使用的「聯繫人」,但是當我接觸的數量,我需要這樣的調用某人打電話:例如;號碼:12345當我觸摸它,呼籲* 12 * 12345# 如果我想通過添加* *修改號碼,我該怎麼辦? 我的應用程序崩潰時,我不喜歡這樣:/修改電話號碼(在iPhone應用程序)

+1

在這裏發佈你的崩潰日誌。 「我的應用程序崩潰」含糊不清,在提問時提供儘可能多的調試信息。 – 0x8badf00d

+1

'phone_number'是什麼類型?如果它是'int',那麼你的格式字符串應該是'@「tel:%i」' – deanWombourne

回答

0

使其更簡單,用說服的方法:

NSString *phoneStr = [NSString stringWithFormat:@"tel:*12*%@",phone_number]; 
NSURL *phoneURL = [NSURL urlWithString:phoneStr]; 
相關問題