I have been tried the following two kinds of codes.
Run time:
if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 4.0) {
CFReadStreamSetProperty(theReadStream, kCFStreamNetworkServiceType, kCFStreamNetworkServiceTypeVoIP);
CFWriteStreamSetProperty(theWriteStream, kCFStreamNetworkServiceType, kCFStreamNetworkServiceTypeVoIP);
}
Compile time:
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_4_0 {
CFReadStreamSetProperty(theReadStream, kCFStreamNetworkServiceType, kCFStreamNetworkServiceTypeVoIP);
CFWriteStreamSetProperty(theWriteStream, kCFStreamNetworkServiceType, kCFStreamNetworkServiceTypeVoIP);
}
kCFStreamNetworkServiceType
and kCFStreamNetworkServiceTypeVoIP
are the constants provided in iOS 4.0. However, I need to build the above codes into the device with iOS 3.1 due to some reasons. If I build the above codes into the device with iOS 3.1, it will crash when I open the application. Are there any ways to solve the problem?