How can I find out whether the user pressed the Call or the Cancel button when making a call from my app?

前端 未结 6 393
梦谈多话
梦谈多话 2020-12-05 20:48

I need to return to my app after making a call from my app, so I use this code:

NSURL *url = [NSURL URLWithString:@\"telprompt://123-4567-890\"]; 
[[UIApplic         


        
6条回答
  •  执笔经年
    2020-12-05 21:27

    This isn't perfect, but you could identify that "call" was pressed instead of "cancel" by listening for the UIApplicationSuspendedNotification (you'd have to add some logic to ignore this event when someone pushed the 'home' key, or was accepting an incoming call... maybe by adding/removing the observer around the logic where the phone number is being presented):

    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(suspended:) name:@"UIApplicationSuspendedNotification" object:nil];
    
    -(void)suspended:(NSNotification *) notification
    {
        NSLog(@"Suspended");
    }
    

提交回复
热议问题