解决SocketException: Connection failed (OS Error: Operation not permitted, errno = 1)

Article directory

The scene appears

Running Flutter APP on iphone and macos, getting the following error.

[ERROR:flutter/lib/ui/ui_dart_state.cc(199)] Unhandled Exception: SocketException: Connection failed (OS Error: Operation not permitted, errno = 1), address = 100.65.182.70, port = 6000

solution

According to the error message, it is found that there is no network permission, just apply for network permission.
In the macos/Runner/ directory, find DebugProfile.entitlements and ReleaseProfile.entitlements, and add the following configuration.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
	加这里
	........
	<true/>
    <key>com.apple.security.network.client</key>
    <true/>
</dict>
</plist>

Re-run to solve.

Guess you like

Origin blog.csdn.net/adojayfan/article/details/123230471