flutter运行IOS真机报错 Undefined symbols for architecture arm64:

925 阅读1分钟

Undefined symbols for architecture arm64:

会看到类似下面信息的报错

Xcode's output:
↳
   Undefined symbols for architecture arm64:
      "OBJC_CLASS$_GeneratedPluginRegistrant", referenced from:
          objc-class-ref in AppDelegate.o
    ld: symbol(s) not found for architecture arm64
    clang: error: linker command failed with exit code 1 (use -v to see
    invocation)
    note: Using new build system
    note: Planning build
    note: Constructing build description

如果遇到这个情况,可以看看自己的flutter版本,用flutter channel

xumin@xumi % flutter channel       
Flutter channels:
* master
  dev
  beta
  stable
  

之前使用的一直是stable,切换成master在运行到真机上就好了

如果在真机上运行可以,但是不能热更新,出现如下提示

 Connecting to the VM Service is taking longer than expected...
Still attempting to connect to the VM Service...
If you do NOT see the Flutter application running, it might have crashed. The device logs (e.g. from adb or XCode) might have more
details.
If you do see the Flutter application running on the device, try re-running with --host-vmservice-port to use a specific port known to
be available.

这是因为mac电脑没有允许。。

转到系统偏好设置>安全和隐私>常规,然后启用“允许从以下位置下载应用程序:Appstore和已确定的开发人员”。您会在该行下方看到“ iproxy”,应启用它。
参考(https://github.com/flutter/flutter/issues/65349)