dinhvh / libetpan

Mail Framework for C Language
www.etpan.org
Other
612 stars 284 forks source link

iOS 16 crash #419

Open akkrat opened 2 years ago

akkrat commented 2 years ago

CFStreamCreatePairWithSocketToHost has been deprecated in iOS 16. When using it app crashes with message "Linked against modern SDK, VOIP socket will not wake. Use Local Push Connectivity instead". But voip is disabled with mailstream_cfstream_voip_enabled by default

Screenshot 2022-09-05 at 12 45 30

Disabling CFStream with mailstream_cfstream_enabled = 0 doesn't work (Tested on custom mailcore2 build)

Xcode: Version 14.0 beta 6 (14A5294g)

dsanghan commented 1 year ago

A workaround is just adding #if __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_16 in mailstream_low_cfstream_open_voip_timeout - MCIMAPSession & MCIMAPAsyncSession use mVoIPEnabled = true; by default in the initializers.

#if __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_16
#if TARGET_OS_IPHONE && !TARGET_IPHONE_SIMULATOR  
  if (voip_enabled) {
    CFReadStreamSetProperty(readStream, kCFStreamNetworkServiceType, kCFStreamNetworkServiceTypeVoIP);
    CFWriteStreamSetProperty(writeStream, kCFStreamNetworkServiceType, kCFStreamNetworkServiceTypeVoIP);
  }
#endif
#endif
rjvishnu87 commented 1 year ago

This crash is because of the kCFStreamNetworkServiceTypeVoIP is deprecated. We need to avoid using kCFStreamNetworkServiceTypeVoIP.

https://developer.apple.com/forums/thread/49363