我使用以下命令从我的应用程序启动FaceTime调用:
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:[@"facetime://" stringByAppendingString:appleID]]]
有没有办法知道FaceTime是否已被使用或者当我调用此方法时URL已经打开?
或者有可能知道我打开URL后何时回到我的应用程序?
所以,我知道FaceTime是否已经在另一个电话中使用/忙碌的是检查我的设备上是否正在播放其他音频,从另一个问题中获取想法:Detecting active AVAudioSessions on iOS device。
// check if other audio is playing
BOOL isPlayingWithOthers = [[AVAudioSession sharedInstance] isOtherAudioPlaying];
if(isPlayingWithOthers){
NSLog(@"other audio is playing - FaceTime could be in use");
//do nothing
}else{
NSLog(@"no other audio is playing - FaceTime not in use");
}
我想这并不能确保FaceTime在我的应用程序之外播放音频,但它可以很好地实现我必须实现的目标。