Making a phone call in an iOS application

前端 未结 3 1742
臣服心动
臣服心动 2020-11-29 22:55

I have some code which attempts to make a call within an application, but it doesn\'t seem to be working:

    UIApplication *myApp = [UIApplication sharedApp         


        
3条回答
  •  鱼传尺愫
    2020-11-29 23:50

    Here's a simple method that can be used to make a call and return to the app after the call is finished.

    Add the following to your .m file

    - (void) dialNumber:(NSString*) number{
    number = [@"telprompt://" stringByAppendingString:number];
    [[UIApplication sharedApplication] openURL:[NSURL URLWithString:number]];
    }
    

    Then add the following code wherever you want to make the call from:

    [self dialNumber:@"5031234567"];
    

提交回复
热议问题