简体   繁体   English

vsCode 不在物理 iPhone 上运行 flutter 应用程序

[英]vsCode doesn't run flutter app on physical iPhone

I just installed the latest version of flutter and xcode and I'm getting an error when I try running the flutter app on an actual iPhone.我刚刚安装了最新版本的 flutter 和 xcode,当我尝试在实际 iPhone 上运行 flutter 应用程序时出现错误。 Works on ios simulator.适用于 ios 模拟器。 The weird thing is that it works when I run it from xcode, but when I run it from vsCode, I get the following error:奇怪的是,当我从 xcode 运行它时它可以工作,但是当我从 vsCode 运行它时,我收到以下错误:

It appears that your application still contains the default signing identifier.
Try replacing 'com.example' with your signing id in Xcode:
  open ios/Runner.xcworkspace

What I tried doing:我尝试做的事情:

  • Change the bundle identifier to myEmailAddress@gmail.com.appTitle将包标识符更改为 myEmailAddress@gmail.com.appTitle
  • Clean and build the ios app清理并构建 ios 应用程序
  • clean then ran flutter build bundle清洁然后运行flutter build bundle

What am I doing wrong and how can I get vsCode to run the app on an iPhone?我做错了什么,如何让 vsCode 在 iPhone 上运行该应用程序?

Here's the full error:这是完整的错误:

Launching lib/main.dart on Jessica’s iPhone in debug mode...
Automatically signing iOS for device deployment using specified development team in Xcode project: ITYTO5RCWD
Xcode build done.                                           25.4s
Failed to build iOS app
Error output from Xcode build:
↳
    2020-04-19 13:53:51.828 xcodebuild[2046:21215] [MT] iPhoneConnect: 📱<DVTiOSDevice ...> == Underlying device preparation errors ==
    2020-04-19 13:53:51.828 xcodebuild[2046:21215] [MT] iPhoneConnect: Failed _shouldMakeReadyForDevelopment check even though device is not locked by passcode.
    Domain: com.apple.platform.iphoneos
    Code: 5
    Failure Reason: allowsSecureServices: 1. isConnected: 0. Platform: <"...platform info...">. DTDKDeviceIdentifierIsIDID: 0
    User Info: {
        DVTDeviceDescription = "...device info..."
    }
    --
    2020-04-19 13:53:51.829 xcodebuild[2046:21215] [MT] iPhoneConnect: 📱<"...platform info..."> == END: Underlying device preparation errors ==
    ** BUILD FAILED **
Xcode's output:
↳
    /Users/Jessica/Development/flutter/.pub-cache/hosted/pub.dartlang.org/audioplayers-0.15.1/darwin/Classes/AudioplayersPlugin.m:88:37: warning: incompatible pointer types sending 'FlutterEngine *' to parameter of type 'NSObject<FlutterBinaryMessenger> * _Nonnull' [-Wincompatible-pointer-types]
                        binaryMessenger:_headlessEngine];
                                        ^~~~~~~~~~~~~~~
    In module 'Flutter' imported from /Users/Jessica/Development/flutter/.pub-cache/hosted/pub.dartlang.org/audioplayers-0.15.1/darwin/Classes/AudioplayersPlugin.h:2:
    /Users/Jessica/Desktop/flutter_game2/ios/Flutter/Flutter.framework/Headers/FlutterChannels.h:178:74: note: passing argument to parameter 'messenger' here
                          binaryMessenger:(NSObject<FlutterBinaryMessenger>*)messenger;
                                                                             ^
    1 warning generated.
    /Users/Jessica/Desktop/flutter_game2/build/ios/Debug-iphoneos/Runner.app: resource fork, Finder information, or similar detritus not allowed
    Command CodeSign failed with a nonzero exit code
    note: Using new build system
    note: Building targets in parallel
    note: Planning build
    note: Constructing build description
Could not build the precompiled application for the device.

It appears that your application still contains the default signing identifier.
Try replacing 'com.example' with your signing id in Xcode:
  open ios/Runner.xcworkspace

Error launching application on Jessica’s iPhone.
Exited (sigterm)

you can change your signing identifier in Xcode您可以在 Xcode 中更改您的签名标识符

To do that, just open your workspace with app in Xcode, then go to signing and capabilities to change default com.example to anything else...为此,只需使用 Xcode 中的应用程序打开您的工作区,然后将 go 更改为签名和将默认 com.example 更改为其他任何内容的功能...

显示如何在 Xcode 中使用应用程序打开工作区的快照,而不是转到签名和将默认 com.example 更改为其他任何内容的功能

Better to use as follows to give app company / organization name最好使用如下给应用程序公司/组织名称

flutter create --org com.yourdomain your_app_name

Swift, Kotlin, and androidx dependencies are the default options Swift、Kotlin 和 androidx 依赖项是默认选项

After just open the created project in Android Studio or in VSCode在 Android Studio 或 VSCode 中打开创建的项目后

Parameter范围

--org com.yourcompany

will form applicationId for Android:将为 Android 形成 applicationId:

com.yourcompany.yourappname and iOS PRODUCT_BUNDLE_IDENTIFIER: com.yourcompany.yourappname 和 iOS PRODUCT_BUNDLE_IDENTIFIER:

com.yourcompany.yourAppName To explore all possible parameters type com.yourcompany.yourAppName 探索所有可能的参数类型

flutter create --help

Alright, so i solved this problem by pressing on the search icon on the top left of vscode, then searching for com.example then i saw three search results that were in the ios folder click on it and replace all three com.example with the identifier you created in xcode.好的,所以我通过按 vscode 左上角的搜索图标解决了这个问题,然后搜索 com.example 然后我看到了 ios 文件夹中的三个搜索结果单击它并将所有三个 Z4D236D9A2D102C5FE6ECADC 替换为您在 xcode 中创建的标识符。

在此处输入图像描述

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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