问题
i develop a calling program in the below way. my main aim is enter the number in textfield and whenever i press the call button it convert
into the integer and then perform calling action.in xcode is there any possibility to create a
code for outgoing call?
And is there any possibility to block the incoming calls?
i am writing the code below way.
my .h file is
@interface mytextViewController : UIViewController
{
IBOutlet UILabel *enterphonenumber;
int currentNumber;
}
@property(nonatomic,retain)IBOutlet UILabel *enterphonenumber;
-(IBAction)call;
-(IBAction)press:(id)sender;
@end
my .m file is
-(IBAction)press:(id)sender
{
currentNumber = currentNumber*10 + (int)[sender tag];
enterphonenumber.text = [NSString stringWithFormat:@"%i",currentNumber];
}
-(IBAction)call
{
int x =[enterphonenumber.text intValue];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:x]];
//[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"%tel:9963610177"]];
NSLog(@"sample %@",[NSURL URLWithString:@"my phone number is calling"]);
}
And also how to examine it performs a calling
please any one help because i am the new to develop this application
Thanking you,
回答1:
Try using the tel protocol.
if ([[[UIDevice currentDevice] model] isEqualToString:@"iPhone"])
{
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:[NSString stringWithFormat:@"tel://%d", number]]];
}
You cannot block any incoming calls.
回答2:
You can't block any incoming calls in your app.
来源:https://stackoverflow.com/questions/9955038/how-make-an-outgoing-call-from-my-app