Note that there are some explanatory texts on larger screens.

plurals
  1. POCallStateDisconnected only detected for incoming calls, not for calls made from my app
    text
    copied!<p>I can't detect end of call (state CallStateDisconnected), if I make call from my app. But if I receive call when my app is active, I can detect that state. I also receive state CTCallStateDialing twice or 3 times when call starts from my app. It used to be working under iOS5, this problems occured with iOS6.</p> <p>My app del code;</p> <pre><code> self.callCenter = [[CTCallCenter alloc] init]; self.callCenter.callEventHandler = ^(CTCall* call) { // anounce that we've had a state change in our call center NSDictionary *dict = [NSDictionary dictionaryWithObject:call.callState forKey:@"callState"]; //BREAKPOINT HERE [[NSNotificationCenter defaultCenter] postNotificationName:@"CTCallStateDidChange" object:self userInfo:dict]; }; </code></pre> <p>Strange thing is that it all works, if I put breakpoint in callEventHandler block and resume execution after call finishes, then I get CallStateDisconnected correctly.</p> <p>Then I subscribe to notifications in my view controller and execute this code when I receive them:</p> <pre><code>- (void)ctCallStateDidChange1:(NSNotification *)notification { NSString *call = [[notification userInfo] objectForKey:@"callState"]; if ([call isEqualToString:CTCallStateDisconnected]) { NSLog(@"Call has been disconnected"); } else if([call isEqualToString:CTCallStateDialing]) { NSLog(@"Call start"); } else if ([call isEqualToString:CTCallStateConnected]) { NSLog(@"Call has just been connected"); } else if([call isEqualToString:CTCallStateIncoming]) { NSLog(@"Call is incoming"); } else { NSLog(@"None"); } </code></pre> <p>}</p> <p>I make call from my app like this:</p> <pre><code> UIWebView *callWebview = [[UIWebView alloc] init]; [self.view addSubview:callWebview]; NSURL *telURL = [NSURL URLWithString:number]; [callWebview loadRequest:[NSURLRequest requestWithURL:telURL]]; </code></pre> <p>I also logged app state and I get <code>- (void)applicationDidBecomeActive:(UIApplication *)application</code> </p> <p>after I start call, then I go to <code>- (void)applicationDidEnterBackground:(UIApplication *)application</code> </p> <p>and after call is finished back to <code>- (void)applicationDidBecomeActive:(UIApplication *)application.</code></p> <p>Is that strange, that <code>DidBecomeActive</code> is called after call is made and before going to background?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload