【发布时间】:2009-04-20 06:52:33
【问题描述】:
我正在使用表格视图,其中每个销售都有一个特定的电话号码,旁边是一个呼叫按钮,按下该号码是拨打该号码...例如,如果我在单元格中有一个电话号码为 (425)821- 1300 我通过如下代码使用字符串变量phonenumberstring将其更改为标准格式425-821-1300
phonenumberstring=[phonenumberstring substringFromIndex:1];
phonenumberstring=[phonenumberstring stringByReplacingOccurrencesOfString:@")" withString:@"-"];
m_strPhoneNumber = [NSString stringWithFormat:@"tel:%@", self.phonenumberstring];
//[[UIApplication sharedApplication] openURL:[NSURL URLWithString:m_strPhoneNumber]];
NSURL *url = [[NSURL alloc] initWithString:m_strPhoneNumber];//1
[[UIApplication sharedApplication] openURL:url];//2
当我在注释的第 1 行和第 2 行进行调试时,事情正在使用这个 url 显示为 nill 并且没有拨打电话
问候
阿伦
【问题讨论】:
标签: iphone