CFNetwork Framework, OS X versus iOS
A question: What are the differences, if any, between CFNetwork framework on iOS and the same framework under OS X?
Mac OS X 10.6 (Snow Leopard)
The framework in question lives under CoreServices in OS X. Look under /System/Library/Frameworks on your Macintosh HD, then under CoreServices.framework, an umbrella framework for the following:
- AE.framework
- CFNetwork.framework, the framework in question
- CarbonCore.framework
- DictionaryServices.framework
- LaunchServices.framework
- Metadata.framework
- OSServices.framework
- SearchKit.framework
iOS 4.3
Assuming you have Xcode installed with the necessary iOS platform, you will find CFNetwork.framework in a different place, under the platform SDK’s system library frameworks at /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.3.sdk then under sub-folder System/Library/Frameworks.
Comparison
Note, you cannot compare the frameworks directly. Frameworks on OS X and iOS have differing layouts. On iOS, frameworks lay out in a much simpler way compared to their OS X counterparts. Also, you cannot compare the binary files. The two different platforms, Intel versus ARM, make machine-code comparisons even more meaningless.
So compare just the framework Headers sub-folder using the following shell command.
$ opendiff /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/CFNetwork.framework/Versions/A/Headers /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.3.sdk/System/Library/Frameworks/CFNetwork.framework/Headers
Note, opendiff is a command-line front-end to Apple’s FileMerge tool, a graphical ‘diff!’
Results
Only three headers of twelve differ.
CFHTTPMessage.h, 4 differencesCFProxySupport.h, 5 differencesCFSocketStream.h, 1 difference
iOS New Features
The details are slightly surprising. In short, iOS has extra features. Perhaps you might assume the reverse. But no.
Negotiate v2 and Kerberos Authentication in iOS 3.0
iOS 3.0 adds support for HTTP Negotiate v2 and Kerberos authentication schemes. The iOS header promises that this will appear in Lion, OS X 10.7. It carries an
__OSX_AVAILABLE_STARTINGmacro to that effect.Proxy PAC JavaScripts in iOS 3.0
Provides access to the full JavaScript source of a proxy’s PAC script.
Stream Service Types in iOS 4.0
Supports VoIP.
Conclusion
There is no significant difference between CFNetwork.framework headers on iOS and OS X. Therefore, logically, no significant difference between functionality even if the implementation details differ somewhat. Main conclusion: Develop against one, and you develop against the other at the same time.
As an aside, it appears as though they are two snapshots of the same code base—as you might expect because the two platforms are merging!