简体   繁体   中英

Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFBoolean length]

在此处输入图片说明

After upgrading some Flutter packages and the Flutter framework of the application i'm working on i got this error on iOS. On VSCode it just build the application, but didn't got any useful info. On Xcode the application started with a white screen then printed this on console.

As i'm not used to iOS - Swift - Xcode ecosystem took me a while to figure this out, the Xcode logs were a bit confusing to me. After reading issues on GitHub this popped out and had something related with my console message What should be the domainNetworkPolicy while using flutter in existing iOS App

This made me realize that was something with the Info.plist file.

The problem was the package flutter_webview_plugin and with its configuration on iOS. The XML code was wrong after updating.

This is the correct XML, thanks to vanelizarov :

<key>NSAppTransportSecurity</key>
        <dict>
            <key>NSAllowsArbitraryLoads</key>
            <true/>
            <key>NSAllowsArbitraryLoadsInWebContent</key>
            <true/>
            <key>NSExceptionDomains</key>
            <dict>
                <key>url.com.br</key>
                <dict>
                    <key>NSExceptionAllowsInsecureHTTPLoads</key>
                    <true/>
                    <key>NSIncludesSubdomains</key>
                    <true/>
                </dict>
            </dict>
        </dict>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM