How WeChat Overcame iOS 9 Compatibility Pitfalls: Solutions & Tips
This guide details the common iOS 9 compatibility issues WeChat encountered—such as Bitcode build failures, HTTP restrictions, canOpenURL limits, API deprecations, window level conflicts, and iPad split‑view challenges—and provides step‑by‑step solutions for each.
iOS 9 Issues Summary
1. Build problems (Bitcode)
After upgrading to Xcode 7, many encounter build failures because Bitcode is enabled by default while third‑party libraries may not contain Bitcode. The error looks like “xxx does not contain bitcode…”. The quick fix is to disable Bitcode in Build Settings → Enable Bitcode = NO, though enabling Bitcode later reduces app size.
xxx does not contain bitcode. You must rebuild it with bitcode enabled (Xcode setting ENABLE_BITCODE), obtain an updated library from the vendor, or disable bitcode for this target.2. HTTP request failures
iOS 9 blocks insecure HTTP by default, requiring HTTPS (TLS 1.2). To allow legacy HTTP calls, add the following to
Info.plist:
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>More granular whitelist and TLS version settings are also possible. Note that even with this flag, HTTP resources referenced from an HTTPS page will not load.
3. canOpenURL limit
iOS 9 limits canOpenURL to 50 schemes. Declare needed schemes in
LSApplicationQueriesSchemesin the plist, or reduce calls. Example:
<key>LSApplicationQueriesSchemes</key>
<array>
<string>weixin</string>
<string>wechat</string>
</array>Replace repetitive checks with a single
openURLcall to avoid consuming whitelist slots:
if (!openUrl(scheme)) then xxx;4. systemName change
In iOS 9.1 beta,
[[UIDevice currentDevice] systemName]returned “iOS” instead of “iPhone OS”, causing backend logic that relied on the string to fail. The fix is to make the backend check configurable; Apple later reverted the value.
5. preferredLanguages format
iOS 9 added a region suffix to language identifiers (e.g., “zh‑Hans‑CN”). This broke language detection in WeChat, showing English for some users. The solution is to match language prefixes instead of exact strings.
6. Deprecated APIs
AddressBookUI.framework → ContactsUI.framework.
UIAlertView → UIAlertController.
UIPopoverController → present a regular UIViewController with
modalPresentationStyle = UIModalPresentationPopover.
7. windowLevel issue
The system keyboard’s windowLevel is extremely high (~10⁷). Custom windows may appear behind it. Two work‑arounds: raise the custom window’s level to 10⁷, or dismiss the keyboard with
[mainWindow endEditing:YES]before showing the window.
8. Launch crash (missing rootViewController)
If the main window lacks a rootViewController at launch, the app crashes with “Application windows are expected to have a root view controller…”. Set a rootViewController before the end of launch.
iPad Multitasking
1. Enabling Split View
Compile with Xcode 7 iOS 9 SDK, use a Launch Storyboard, and support all interface orientations. If you do not want split view, check “Requires full screen” in the project’s Deployment Info.
2. Adapting UI for Split View
Design layouts that respond to size class changes (Regular ↔ Compact). WeChat uses configuration files to apply iPhone‑5 layout for 320 pt width, iPhone‑6 layout for 438 pt width, and iPad layout for larger widths.
3. Common Split View issues
Use
[UIScreen mainScreen].boundsonly for full‑screen; in split view, obtain the window’s frame instead.
Replace deprecated rotation callbacks with
viewWillTransitionToSize:withTransitionCoordinator:.
Video recording is unavailable in split view; inform users accordingly.
Avoid hard‑coded screen sizes because the visible area changes dynamically.
Conclusion
The article summarizes the typical problems WeChat faced when adapting to iOS 9 and provides practical solutions, encouraging developers to share additional iOS 9 pitfalls.
WeChat Client Technology Team
Official account of the WeChat mobile client development team, sharing development experience, cutting‑edge tech, and little‑known stories across Android, iOS, macOS, Windows Phone, and Windows.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.