I am trying to implement the background mode with async socket. The following are a few codes:
CFReadStreamRef theReadStream;
CFWriteStreamRef theWriteStream;
if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 4.0) {
CFReadStreamSetProperty (theReadStream, kCFStreamNetworkServiceType, kCFStreamNetworkServiceTypeVoIP);
CFWriteStreamSetProperty(theWriteStream, kCFStreamNetworkServiceType, kCFStreamNetworkServiceTypeVoIP);
}
I know kCFStreamNetworkServiceType
and kCFStreamNetworkServiceTypeVoIP
are available in iPhone with iOS started at 4.0.
The above codes were workable indeed when I built into iPhone with iOS started at 4.0.
However, I could not build the above codes into iPhone with iOS 3.1 successfully.
I have added the statement, ([[[UIDevice currentDevice] systemVersion] floatValue] >= 4.0)
, to the above codes.
I don't know why I could not enter the program at all especially I have added the if statement.