Issue
Writing a simple app, no plugins (yet) with Ionic react v 5.3.0
After ionic build, Xcode reports swift build error:
Type 'UIStatusBarStyle' has no member 'darkContent' ios
This happens with swift v 4.2 and swift v 5, ios deployment target 8, 9, 10, and 11
I attempt to solve by deleting and regenerating node_modules
and ios
directories per the instructions here: https://ionicframework.com/docs/troubleshooting/native
Still seeing the issues in xcode with buildtime warnings and 4 Swift complie errors.
Two of those errors are Type 'UIColor' has no member 'systemBackground'
found in CapBridgeViewcontroller.swift from Pods>Development Pods> Capacitor > Plugins
if let backgroundColor = (bridge!.config.getValue("ios.backgroundColor") as? String) ?? (bridge!.config.getValue("backgroundColor") as? String) {
webView?.backgroundColor = UIColor(fromHex: backgroundColor)
webView?.scrollView.backgroundColor = UIColor(fromHex: backgroundColor)
} else if #available(iOS 13, *) {
// Use the system background colors if background is not set by user
webView?.backgroundColor = UIColor.systemBackground
webView?.scrollView.backgroundColor = UIColor.systemBackground
}
And the other two errors are:
Type 'UIStatusBarStyle' has no member 'darkContent'
found in statusBar.swift
public func setStatusBarDefaults() {
if let plist = Bundle.main.infoDictionary {
if let statusBarHidden = plist["UIStatusBarHidden"] as? Bool {
if (statusBarHidden) {
self.isStatusBarVisible = false
}
}
if let statusBarStyle = plist["UIStatusBarStyle"] as? String {
if (statusBarStyle == "UIStatusBarStyleDarkContent") {
if #available(iOS 13.0, *) {
self.statusBarStyle = .darkContent
} else {
self.statusBarStyle = .default
}
} else if (statusBarStyle != "UIStatusBarStyleDefault") {
self.statusBarStyle = .lightContent
}
}
}
}
and
@objc func setStyle(_ call: CAPPluginCall) {
let options = call.options!
if let style = options["style"] as? String {
if style == "DARK" {
bridge.setStatusBarStyle(.lightContent)
} else if style == "LIGHT" {
if #available(iOS 13.0, *) {
bridge.setStatusBarStyle(.darkContent)
} else {
bridge.setStatusBarStyle(.default)
}
}
}
call.success([:])
}
What I expect is that I can build my app from ionic cli and not have to modify swift code every time I build. Is there a setting I could add in my ionic project that would prevent this error?
Solution
Capacitor requires Xcode 11 to build
https://capacitorjs.com/docs/getting-started/dependencies#ios-development
Answer above was found a: https://github.com/ionic-team/capacitor/issues/3338
Answered By - Gerry R
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.