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

前端 未结 6 397
梦谈多话
梦谈多话 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:29

    Try this,I deal with this issue as follows:

    in -(void)viewDidLoad add the following :

    NSNotificationCenter *center = [NSNotificationCenter defaultCenter];
    
    [center addObserverForName:UIApplicationDidBecomeActiveNotification
                        object:nil
                         queue:[NSOperationQueue mainQueue]
                    usingBlock:^(NSNotification *note)
     {
         // use instance flag to know
         if (self.isBeginCallPhone)
         {
             //do some thing
             self.isBeginCallPhone = NO;
         }
     }];
    

    Do not forget:

    - (void)dealloc{
        [[NSNotificationCenter defaultCenter]removeObserver:self];
      }
    

提交回复
热议问题