flutter: "fatal error: module 'location' not found" Xcode cannot found modules

flutter: "fatal error: module 'location' not found" Xcode cannot found modules

我尝试使用地理定位器获取当前位置,但 Xcode(在 M1 Mac/ arm64 上)无法检测到模块。经过一番研究,我干脆改了个插件,集成了推荐的pub locator。但是,在那之后,仍然会出现相同的错误。也找不到这个模块。

↳
    objc[7998]: Class AMSupportURLConnectionDelegate is implemented in both /usr/lib/libamsupport.dylib (0x1eab43130) and
    /Library/Apple/System/Library/PrivateFrameworks/MobileDevice.framework/Versions/A/MobileDevice (0x1080f02c8). One of the two will be used. Which one is undefined.
    objc[7998]: Class AMSupportURLSession is implemented in both /usr/lib/libamsupport.dylib (0x1eab43180) and
    /Library/Apple/System/Library/PrivateFrameworks/MobileDevice.framework/Versions/A/MobileDevice (0x1080f0318). One of the two will be used. Which one is undefined.
    ** BUILD FAILED **


Xcode's output:
↳
    /Users/campermike/Documents/projects/cnow/ios/Runner/GeneratedPluginRegistrant.m:18:9: fatal error: module 'location' not found
    @import location;
     ~~~~~~~^~~~~~~~

我最近遇到了类似的错误,如果您想节省时间,请按照我的方法操作。 你需要 crate new project with same bundle id in your m1 Mac machine and just replace your codes & ios & Android mandatory files. Because all errors are architecture related.

但在此之前请做以下事情:

1.Remove 发布缓存。
2.Flutter干净
3.Remove xcode 派生数据。