100％完璧な Native 管理ツールを作成するのはほぼ不可能です。遅かれ早かれ iOS ワークフローの一部でさまざまな問題に遭遇するでしょう。
このガイドでは、考えられる解決策とともに一般的な iOS / Xcode の問題を文書化することを試みます。
Every iOS developer learns a few common techniques for debugging iOS issues, and you should incorporate these into your workflow:
Any time you encounter an issue with iOS, or Xcode, your first step should be to copy and paste the error into a Google search.
Capacitor uses the standard iOS toolchain, so chances are if you run into something, many iOS developers have as well, and there’s a solution out there.
It could be as simple as updating a dependency, running clean, or removing Derived Data.
Cleaning and rebuilding can fix a number of build issues. Navigate to Product -> Clean in the Xcode menu to clean your current build.
Sometimes, Xcode clings to old, outdated build artifacts. To start fresh, you’ll need to delete any Derived Data on disk.
To do this, open Xcode Preferences, choose the Locations tab, and click the small arrow next to your Derived Data path:
This opens a Finder window to the location of Xcode’s temporary Derived Data.
Next, select all items in that directory and delete:
Finally, do a rebuild in Xcode.
This error occurs when Capacitor’s
native-bridge.js file was not copied to the native project.
The fix is simple: run
npx cap copy ios to copy this file.
This error can happen if CocoaPods hasn’t been able to run to install your dependencies.
Run this to update your pods:
npx cap update ios
Perform a new build after running this command.
Xcode sometimes gets stuck indexing forever. This unfortunate situation looks like this:
The only solution is to Force Close Xcode (using Activity Monitor) and start it up again.
This error can happen on Macs with an old version of openssl and ruby installed, since GitHub restricted the allowed cryptographic protocols when accessing repos.
The solution is to update openssl and update Ruby:
brew install openssl brew upgrade openssl brew install ruby brew link --overwrite ruby
Finally, make sure your
PATH environment variable does not put
$PATH, but rather
See this StackOverflow issue for other possible solutions to this problem.