Tom
Tom

Reputation: 23

Objective-c make phone call in background mode

I have to solve the following problem in objective-c:

  1. Application in background
  2. For an event, i need to call a specific phone number on the iPhone while it is still in background

As i see my logs, the phone call method will be called, but the phone number not dialing by the iOS.

Here is the action method:

//------------------------------------------------//

- (IBAction)actionCall:(id)sender
{  
  id<ICallModel> _AutoCall = [self retrieveAutoCall];

  if(_AutoCall != nil)
  {
    DDLogDebug(@"RESCUE CALL: %@",_AutoCall.PhoneNumber);

    [[UIApplication sharedApplication] openURL:[NSURL URLWithString:[NSString stringWithFormat:@"tel:%@",_AutoCall.PhoneNumber]]];
  }

  [self actionCancel:nil];

}

//------------------------------------------------//

If the application is active, then it works perfectly. I've added the proper background modes too.

Is it possible some way to achieve this flow?

Thanks, Tom

Upvotes: 0

Views: 851

Answers (1)

riisemichi
riisemichi

Reputation: 123

Apple doesn't allow you to start calls if your app is running in the background.

What you could do is using Local Notifications to make the user returning to your app. Once your app is back in the foreground it could start the call.

Upvotes: 2

Related Questions