我正在使用 Ionic 和 Capacitor 开发一个应用程序。构建是使用 Ionic 的新 AppFlow 服务生成的,所以我不在本地构建它们。
如何更新 iOS 和 Android 版本号?我已经尝试更新 plist 和 config.xml,但无论我做什么,所有更新都会导致版本号为“1.0”。
我刚刚创建了一个全新的 Ionic 应用程序,使用命令“ionic start myApp Blank”
\n我添加了必要的角度依赖性以使“离子服务”正常工作。
\n我已经使用以下命令安装了电容器
\nnpm install @capacitor/cli @capacitor/core\nnpx cap init\n\nnpm install @capacitor/ios @capacitor/android\nRun Code Online (Sandbox Code Playgroud)\n我的 Package.json 如下所示,
\n{\n "name": "myApp",\n "version": "0.0.1",\n "author": "Ionic Framework",\n "homepage": "https://ionicframework.com/",\n "scripts": {\n "ng": "ng",\n "start": "ng serve",\n "build": "ng build",\n "test": "ng test",\n "lint": "ng lint",\n "e2e": "ng e2e"\n },\n "private": true,\n "dependencies": {\n "@angular/common": "~12.1.1",\n "@angular/core": "~12.1.1",\n "@angular/forms": "~12.1.1",\n "@angular/platform-browser": "~12.1.1",\n "@angular/platform-browser-dynamic": "~12.1.1",\n "@angular/router": "~12.1.1",\n "@capacitor/android": "^3.2.4",\n "@capacitor/app": "1.0.3",\n "@capacitor/core": "^3.2.4",\n "@capacitor/haptics": "1.1.0",\n "@capacitor/ios": …Run Code Online (Sandbox Code Playgroud) 我正在维护一个支持 iOS 和 Android 平台的电容器离子项目。我可以在本地构建项目并在设备上运行它,没有任何问题。但是归档的时候会出现如下错误:
PhaseScriptExecution [CP]\ Embed\ Pods\ Frameworks
/Users/fabus/Library/Developer/Xcode/DerivedData/App-
gkhellzebxgrxeeuozvkjsnejnul/Build/Intermediates.noindex/ArchiveInter
mediates/App/IntermediateBuildFilesPath/App.build/Release-
iphoneos/App.build/Script-9592DBEFFC6D2A0C8D5DEB22.sh (in target
'App' from project 'App') cd
/Users/fabus/Development/showmaker/showmaker_festivals/ios/App
/bin/sh -c /Users/fabus/Library/Developer/Xcode/DerivedData/App-
gkhellzebxgrxeeuozvkjsnejnul/Build/Intermediates.noindex/ArchiveInter
mediates/App/IntermediateBuildFilesPath/App.build/Release-
iphoneos/App.build/Script-9592DBEFFC6D2A0C8D5DEB22.sh
Run Code Online (Sandbox Code Playgroud)
mkdir -p /Users/fabus/Library/Developer/Xcode/DerivedData/App-
gkhellzebxgrxeeuozvkjsnejnul/Build/Intermediates.noindex/ArchiveInter
mediates/App/BuildProductsPath/Release-iphoneos/App.app/Frameworks
Symlinked... rsync --delete -av --filter P .*.?????? --links --filter
"- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --
filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules"
"../../../IntermediateBuildFilesPath/UninstalledProducts/iphoneos/Cap
acitor.framework"
"/Users/fabus/Library/Developer/Xcode/DerivedData/App-
gkhellzebxgrxeeuozvkjsnejnul/Build/Intermediates.noindex/ArchiveInter
mediates/App/InstallationBuildProductsLocation/Applications/App.app/F
rameworks" building file list ... rsync: link_stat
"/Users/fabus/Development/showmaker/showmaker_festivals/ios/App/../.. …Run Code Online (Sandbox Code Playgroud) 在 Cordova 中,您可以立即访问process.env.CORDOVA_PLATFORMCapacitor 中是否有类似的东西?
我希望在启动时有条件地加载一些函数,并且不想阻止渲染等待异步Device.getInfo返回。
例如,我想立即确定是否导入进行本机键盘修改的脚本,但如果我们在网络上运行,我不想导入此脚本
try {
const { Keyboard } = Plugins
Keyboard.setAccessoryBarVisible({ isVisible: true })
} catch (error) {
// Keyboard isn't available on web so we need to swallow the error
}
Run Code Online (Sandbox Code Playgroud)
我正在使用 vue-cli
我一直在研究这个例子: https //capacitor.ionicframework.com/docs/basics/cordova
我跑了:
npm install cordova-plugin-qrscanner
npx cap sync
Run Code Online (Sandbox Code Playgroud)
我可以看到安装在我的 node_modules 中的插件。
我不知道该怎么做是调用cordova-plugin 上的功能之一。我想知道我是否需要像 webpack 这样的打包器?
如果cordova插件包含本机swift(或其他)代码,我也很困惑这是如何工作的。
当我尝试“ionic cap 同步”时,ios 更新出现错误
\n错误 :
\n\xe2\x9c\x96 使用“pod install”更新 iOS 本机依赖项(可能需要几分钟):\n\xe2\x9c\x96 更新 ios:\n[错误] 运行更新时出错:分析依赖项\n[!] CocoaPods找不到 pod“Capacitor”的兼容版本:\n在 Podfile 中:\nCapacitor(来自../../node_modules/@capacitor/ios)
找到了满足Capacitor (from ../../node_modules/@capacitor/ios)依赖项的规范,但它们需要更高的最低部署目标。
播客文件:
\nplatform :ios, '11.0'\nuse_frameworks!\n\n# workaround to avoid Xcode caching of Pods that requires\n# Product -> Clean Build Folder after new Cordova plugins installed\n# Requires CocoaPods 1.6 or newer\ninstall! 'cocoapods', :disable_input_output_paths => true\n\ndef capacitor_pods\n # Automatic Capacitor Pod dependencies, do not delete\n pod 'Capacitor', :path => '../../node_modules/@capacitor/ios'\n pod 'CapacitorCordova', :path …Run Code Online (Sandbox Code Playgroud) 首先,希望这个问题不要太宽泛。来自前端背景,我正在考虑开始学习与 JavaScript 相关的移动开发框架之一。这是第一个问题,我应该使用 Apache Cordova 还是 Capacitor?第一个是我用于 Phaser (HTML5) 游戏开发的业余爱好项目,老实说,这不是最好的体验。根据 Stack Overflow 年度报告,我能感觉到为什么 Apache Cordova 是最令人讨厌的技术之一。
然后是第二个问题,我应该使用 Ionic、NativeScript 还是 React Native?React 是“三大”中唯一一个我目前感到不舒服的前端框架。我在 Angular 和 Vue.js 方面的经验相当积极,我也想在我的移动应用程序项目中使用其中的任何一个,因此我有点偏向于 Ionic 或 NativeScript。另一方面,React Native 拥有最多的 GitHub star。我认为这可能是有原因的。
那么最后一个,我可以将以下任何一个组合:Apache Cordova/Capacitor 与以下任何一个:Ionic/NativeScript/React Native 或者有一些更容易工作的东西,例如 Capacitor 和 Ionic 的组合?同一家公司这样做,因此我认为它应该是相对无缝的组合。
编辑:
最后一个 - 为了从我的移动应用程序的相同代码库制作 PWA,我被迫只使用 Ionic?
我正在致力于Ionic React Project在Capacitor. 我添加了Android平台,一切都很顺利。现在我正在尝试让我的应用程序在 iOS 中运行(第一次使用 iOS),在添加 ios 平台并在 XCode 中打开我的项目后,我遇到了一些问题。
查看错误:
Pod 文件内容:
任何帮助将非常感激。谢谢你!
当我跑步时npx cap sync,我得到:
npm ERR! could not determine executable to run
Run Code Online (Sandbox Code Playgroud)
关于此错误有人提出了几个问题,但没有一个与电容器有关。今天安装 3 个电容器插件后开始出现错误。
在我在线研究的解决方案中,似乎没有一个有效。我已经完成了npm install,我已经将 npm 和 Node 更新到了最新版本,一些工作解决方案甚至建议降级 Node,我认为这并不理想。我一直在研究这个。
使用cordova-res.
我正在使用电容器来构建应用程序
我正在使用以下命令复制图标:
cordova-res android --skip-config --copy
Run Code Online (Sandbox Code Playgroud)
这是命令的响应:
~/Public/accountech-ecommerce/ionic-files$ cordova-res android --skip-config --copy
Generated 18 resources for Android
WARN: Error occurred while copying resources/android/icon/mdpi-foreground.png
WARN: Error occurred while copying resources/android/icon/mdpi-background.png
WARN: Error occurred while copying resources/android/icon/hdpi-foreground.png
WARN: Error occurred while copying resources/android/icon/hdpi-background.png
WARN: Error occurred while copying resources/android/icon/xhdpi-foreground.png
WARN: Error occurred while copying resources/android/icon/xhdpi-background.png
WARN: Error occurred while copying resources/android/icon/xxhdpi-foreground.png
WARN: Error occurred while copying resources/android/icon/xxhdpi-background.png
WARN: Error occurred while copying resources/android/icon/xxxhdpi-foreground.png
WARN: Error occurred while copying resources/android/icon/xxxhdpi-background.png …Run Code Online (Sandbox Code Playgroud)