Changes between Version 112 and Version 113 of Getting-Started/iPhone


Ignore:
Timestamp:
Sep 22, 2022 3:39:11 AM (2 years ago)
Author:
nanang
Comment:

Add handle crash on iOS16 due to using VoIP socket

Legend:

Unmodified
Added
Removed
Modified
  • Getting-Started/iPhone

    v112 v113  
    215215== Common problems == 
    216216 
    217 === !PushKit guide, to accept calls in the background after ```kCFStreamNetworkServiceTypeVoIP``` is deprecated (iOS 10/iOS 9) === #bg-call 
    218  
    219 Starting in iOS 9, [https://developer.apple.com/library/ios/documentation/CoreFoundation/Reference/CFSocketStreamRef/index.html#//apple_ref/doc/constant_group/Stream_Service_Types kCFStreamNetworkServiceTypeVoIP] is deprecated. Apple recommends that applications use VoIP Push Notifications (using !PushKit framework) to avoid persistent connections as described in the [https://developer.apple.com/library/ios/documentation/Performance/Conceptual/EnergyGuide-iOS/OptimizeVoIP.html Apple's official doc]. This will require application to implement the setup and handling of push notifications in the application layer (for more details, you can refer to ticket #1941). For now, PJSIP will still use ```kCFStreamNetworkServiceTypeVoIP```, if you want to disable it right away, you can set ```PJ_IPHONE_OS_HAS_MULTITASKING_SUPPORT``` to 0. 
     217=== !PushKit guide, to accept calls in the background after `kCFStreamNetworkServiceTypeVoIP` is deprecated (iOS 16/iOS 10/iOS 9) === #bg-call 
     218 
     219Starting in iOS 9, [https://developer.apple.com/library/ios/documentation/CoreFoundation/Reference/CFSocketStreamRef/index.html#//apple_ref/doc/constant_group/Stream_Service_Types kCFStreamNetworkServiceTypeVoIP] is deprecated. Apple recommends that applications use VoIP Push Notifications (using !PushKit framework) to avoid persistent connections as described in the [https://developer.apple.com/library/ios/documentation/Performance/Conceptual/EnergyGuide-iOS/OptimizeVoIP.html Apple's official doc]. This will require application to implement the setup and handling of push notifications in the application layer (for more details, you can refer to ticket #1941). For now, PJSIP will still use `kCFStreamNetworkServiceTypeVoIP`, if you want to disable it right away, you can set `PJ_IPHONE_OS_HAS_MULTITASKING_SUPPORT` to 0. 
    220220 
    221221Starting from iOS 13, there's a new requirement: 
    222222{{{Apps receving VoIP pushes must post an incoming call (via CallKit or IncomingCallNotifications) in the same run loop as pushRegistry:didReceiveIncomingPushWithPayload:forType:[withCompletionHandler:] without delay. Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Killing app because it never posted an incoming call to the system after receiving a PushKit VoIP push callback.'}}} 
    223223In order to make it work with the normal SIP flow which may require you to wait for some time to receive the INVITE message, please look at Apple's recommendation in its [https://forums.developer.apple.com/thread/117939 developer forum]. 
     224 
     225Starting from iOS 16, using VoIP socket (or `kCFStreamNetworkServiceTypeVoIP`) will cause app getting crashed or killed, under debugger it will show a message like below in the call stack: 
     226{{{ 
     227"Linked against modern SDK, VOIP socket will not wake. Use Local Push Connectivity instead" 
     228}}} 
     229Application using PJSIP 2.12.1 or older can use the following settings in `config_site.h` to avoid that: 
     2301. Leave `PJ_IPHONE_OS_HAS_MULTITASKING_SUPPORT` to `1` (note that by default it is already `1`), this is for maintaining UDP-replacing-socket feature which is still required. 
     2312. Set `PJ_ACTIVESOCK_TCP_IPHONE_OS_BG` to `0`, or alternatively call `pj_activesock_enable_iphone_os_bg(PJ_FALSE)` before creating any SIP transport or any PJSIP socket in general, this is for disabling the VOIP socket. 
    224232 
    225233=== !CallKit integration and audio session (AVAudioSession) management (iOS 10) ===