我有一个基于Angular 1.6和Ionic v1的cordova应用程序.我在iOS上面临一个可怕的问题,我甚至不知道出了什么问题.我将解释这个问题以及到目前为止我所尝试的内容,希望有人会对此有所了解.
问题
我们有一个简单的屏幕,你可以填写一些文字并添加附件.对于附件,您可以:
然后,您可以保存记录,该记录将所有内容存储在文件系统上.或者上传到服务器,再次将记录存储在您的设备上.
问题是,当我从库或任何其他来源选择文件时,应用程序很快意外崩溃.我可以添加附件并保存/上传,但是当我离开时,应用程序崩溃了.这只发生在iOS上.没有错误,没有警告,没有可调试的输出,只是崩溃.我检查了iPhone上的崩溃日志,显然主线程被阻塞超过5秒.这导致看门狗违规异常被抛出.很难说是什么导致这个线程锁定,不知道.
我正在使用运行iOS 12.1的iPhone 8.值得一提的是,该应用程序在模拟器上工作正常,没有错误或崩溃.
我迄今为止所做的
一切起初,我认为我的代码可能出了问题.所以我逐行检查了每个代码文件,重构了我的JS代码并提高了代码质量.确保promises按预期工作,解决JSLint/TSLint警告等问题.
我已将所有cordova插件更新到最新版本.同时删除了两个平台并添加了最新版本.他们都没有帮助.所以我想也许我错过了配置怪癖等等.通过github文档和SO线程挖掘,找不到任何有用的东西.我尝试过的其他一些事情:
他们都没有工作.我已经在这个问题上苦苦挣扎了两个星期了.
奇怪的部分
令我困惑的是,当我定位我的本地开发机器时,也就是说,当我将API调用的基本URL设置为指向我的本地IIS时,应用程序运行得非常好.没有错误/错误,没有崩溃.
但是当我瞄准我们的远程服务器时,当我尝试使用附件(相机,iCloud等)时,应用程序崩溃了.我不知道我在这里缺少什么.我的机器和远程服务器之间没有区别.两者都运行完全相同的软件,相同的配置,并且移动应用程序是相同的构建,在同一设备上运行.
所以我可以肯定地说,这个问题与我的应用程序代码或Cordova及其插件无关.在定位我的本地IIS时,相同的构建工作完美.
我的应用程序已经投入生产,现在需要修复.这让我很生气,我已经尝试了所有我能想到的东西,但仍然没有运气.有没有人有类似的问题?任何帮助表示赞赏.
我没有权限分享我的代码,就像我说的那样,代码没有任何问题,在针对我的本地IIS时,它的工作原理非常好.但是供您参考,这里有一些关于我的项目的信息.
Config.xml中的首选项
<preference name="SplashScreen" value="screen" />
<preference name="windows-target-version" value="10.0" />
<preference name="AndroidPersistentFileLocation" value="Internal" />
<preference name="iosPersistentFileLocation" value="Library" />
<preference name="webviewbounce" value="false" />
<preference name="UIWebViewBounce" value="false" />
<preference name="DisallowOverscroll" value="true" />
<preference name="BackupWebStorage" value="local" />
Run Code Online (Sandbox Code Playgroud)
Cordova插件
<plugin name="cordova-plugin-geolocation" spec="^2.4.3">
<variable name="GEOLOCATION_USAGE_DESCRIPTION" value="Location access allows …
Run Code Online (Sandbox Code Playgroud) Cordova IOS 应用程序在 IOS 14 中显示白屏。但应用程序在 IOS 14 版本以下运行。我将 Xcode 更新到版本 12.0。Cordova IOS平台版本是6.1.0。Cordova 版本是 10.0.0。以下是 config.xml 文件中的插件详细信息和首选项。
<plugin name="cordova-plugin-whitelist" spec="1" />
<access origin="*" />
<allow-intent href="http://*/*" />
<allow-intent href="https://*/*" />
<allow-intent href="tel:*" />
<allow-intent href="sms:*" />
<allow-intent href="mailto:*" />
<allow-intent href="geo:*" />
<platform name="ios">
<allow-intent href="itms:*" />
<allow-intent href="itms-apps:*" />
</platform>
<preference name="scheme" value="app" />
<preference name="hostname" value="localhost" />
<plugin name="cordova-plugin-network-information" spec="^2.0.2" />
<plugin name="cordova-plugin-statusbar" spec="^2.4.3" />
<plugin name="cordova-plugin-splashscreen" spec="^6.0.0" />
<plugin name="cordova-plugin-inappbrowser" spec="^4.0.0" />
<preference name="auto-hide-splash-screen" value="false" />
<preference …
Run Code Online (Sandbox Code Playgroud) 我正在使用平台Cordova来创建iOs,Android和Windows App.我试图了解Cordova的所有内容,我认为自己非常善于使用该工具.
将xCode 6.4升级到7后,我遇到了问题.当我尝试在终端中构建我的iOs App时会出现问题.我在这个错误中得到一个错误,产生一些额外的冲突,再次看到构建:
//错误AppDelegate.m:138:1:警告:'application:supportedInterfaceOrientationsForWindow:':'UIInterfaceOrientationMask'(又名'enum UIInterfaceOrientationMask')与'NSUInteger'(又名'unsigned int')实现中的冲突返回类型[-Wmismatched -return-types] //错误
我一直在寻找很多论坛,但仍无法找到解决方案.有人可以帮我解决这个问题吗?
我有一个使用 phonegap (cordova) 构建的移动应用程序,并且该应用程序已在应用程序商店中上线,但是 iOS10 测试版的这个新功能:
为了提高 Safari 中网站的可访问性,即使网站在视口中设置了user-scalable=no,用户现在也可以双指缩放。
使应用程序可缩放,并且在缩放时完全破坏了应用程序的设计。
也许这是移动(或不是)网站的一项功能,但我希望能够为混合移动应用程序禁用此功能
这就是里面的viewport
样子index.html
<meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, target-densitydpi=medium-dpi, width=device-width, height=device-height" />
Run Code Online (Sandbox Code Playgroud)
对于即将发布的新 iOS,是否有解决此问题的已知解决方案?
我正在使用WkWebView
和
<engine name="ios" spec="~3.9.2" />
<preference name="phonegap-version" value="cli-5.2.0" />
Run Code Online (Sandbox Code Playgroud)
更新
我将 phonegap 更新为 6.3.0 版本,将 ios 平台版本更新为 4.1.1,但我遇到了同样的错误。
我在iOS上建立离子应用程式时遇到问题。如果运行release build命令,则归档成功,但导出失败,并显示以下错误:
错误:exportArchive:“ TeaZe.app”需要具有“推送通知”功能的配置文件。
Error Domain = IDEProvisioningErrorDomain代码= 9““ TeaZe.app”需要具有推送通知功能的配置文件。” UserInfo = {NSLocalizedDescription =“ TeaZe.app”需要具有推送通知功能的配置文件。NSLocalizedRecoverySuggestion =添加配置文件导出选项属性列表中的“ provisioningProfiles”字典。}
**出口失败**
我仍然可以在xcode中构建和存档应用程序而没有任何错误,但是我发现推送通知不再起作用!
我的构建环境:
Ionic CLI 3.20.0
ionic1 1.3.3
ios 4.5.3
XCode 9.3
Run Code Online (Sandbox Code Playgroud)
似乎为cordova配置了一些文件,但我不知道该怎么办。我删除了所有证书/配置文件,并重新创建了xcode和cordova-ios,将其更新为最新版本。还尝试降级xcode,但与我的iPhone不兼容,因此不值得。
有人遇到过这个吗?
我正在创建一个Angular + Cordova应用程序,它在浏览器中效果很好。
我面临的问题是,当我尝试包含cordova.js
文件时,该应用程序在加载到设备上后变为空白。我做了一些研究,它原来是用的东西cordova.exec
,并zone.js
在角使用造成的问题。
我想要一个关于如何正确包含cordova.js
在基于Angular的项目中的解决方案。
科尔多瓦
android 8.0.0
ios 5.0.1
Run Code Online (Sandbox Code Playgroud)
角度的
@angular-devkit/architect 0.801.1
@angular-devkit/build-angular 0.801.1
@angular-devkit/build-optimizer 0.801.1
@angular-devkit/build-webpack 0.801.1
@angular-devkit/core 8.1.1
@angular-devkit/schematics 8.1.1
@ngtools/webpack 8.1.1
@schematics/angular 8.1.1
@schematics/update 0.801.1
rxjs 6.4.0
typescript 3.4.5
webpack 4.35.2
Run Code Online (Sandbox Code Playgroud) 刚刚收到苹果的通知:
从 2020 年 4 月开始,iPad 的所有新应用和应用更新都需要使用 iOS 13 SDK 构建,并支持 12.9 英寸 iPad Pro(第 3 代)的全屏设计。
cordova-ios 是否支持使用 Xcode 11 和 iOS 13 SDK 进行构建?
处理这款 iPad Pro 有什么问题吗?
我有一个普通的 Cordova 应用程序,当我在 iOS 14 beta 上运行它时,该应用程序卡在启动屏幕上,并且 XCode 中记录的警告/错误很少,但我不确定它是否导致了问题。
我创建了一个空白的 Cordova 应用程序来测试它是否在 iOS 14 上运行,当我在设备上运行它时,该应用程序按预期工作,但是当我将应用程序设置为使用WKWebView而不是UIWebView 时,该应用程序卡在启动屏幕上。
我添加了以下首选项以在 config.xml 文件中使用 WKWebView。
<preference name="WKWebViewOnly" value="true" />
<feature name="CDVWKWebViewEngine">
<param name="ios-package" value="CDVWKWebViewEngine" />
</feature>
Run Code Online (Sandbox Code Playgroud)
我还添加了cordova-plugin-wkwebview-engine,但我不知道它是否帮助我设置了WKWebView。
下面是我在 XCode 中得到的错误:
2020-08-17 12:01:37.990216+0530 BankWindhoek[58947:1465531] nil host used in call to allowsAnyHTTPSCertificateForHost:
2020-08-17 12:01:37.991180+0530 BankWindhoek[58947:1465531] nil host used in call to allowsSpecificHTTPSCertificateForHost
Run Code Online (Sandbox Code Playgroud)
但是在收到此错误后,XCode 会打印出已加载 index.html 的声明
2020-08-17 12:01:38.039671+0530 BankWindhoek[58947:1465275] Finished load of: file:///Users/user1/Library/Developer/CoreSimulator/Devices/88FDF8E3-EDCE-4BB6-95B3-29CA606DA2C5/data/Containers/Bundle/Application/6EE35C46-E78E-4E49-B836-17EBDE6CD664/test.app/www/index.html
Run Code Online (Sandbox Code Playgroud)
但是在应用程序的 UI 上,没有任何内容正确呈现并显示空白屏幕。
配置:
科尔多瓦版本:9.0.0
Cordova-ios:5.1.1
注意:如果我在 iOS …
目标是在应用程序启动时在webview中打开外部URL.
我创建了新的Cordova项目:
cordova create test
cd test
cordova platform add ios
cordova plugin add cordova-plugin-inappbrowser
Run Code Online (Sandbox Code Playgroud)
我将此脚本内联到www/index.html
:
<script>
document.addEventListener("deviceready", onDeviceReady, false);
function onDeviceReady() {
cordova.InAppBrowser.open('https://google.com', '_self');
}
</script>
Run Code Online (Sandbox Code Playgroud)
我测试应用程序cordova run ios
,应用程序启动,我得到这个:
拒绝执行脚本,因为它的散列,其随机数或"unsafe-inline"既不出现在script-src指令中,也出现在内容安全策略的default-src指令中.
所以我添加'unsafe-inline'
到内容安全策略标记,它变为:
<meta
http-equiv="Content-Security-Policy"
content="
default-src 'self' data: gap: https://ssl.gstatic.com 'unsafe-eval' 'unsafe-inline';
style-src 'self' 'unsafe-inline';
media-src *;
img-src 'self' data: content:;">
Run Code Online (Sandbox Code Playgroud)
我在应用cordova run ios
程序启动时测试应用程序,但它https://google.com
在Safari中打开:
我该如何打开Cordova webview本身的网址?
我也试过window.location="https://google.com"
,同样的行为.
跑步cordova build ios --device --release
让我有:
...
CodeSign /Users/birowsky/Library/Developer/Xcode/DerivedData/???????-eihflkqaiafhhrgatfbnarfxvrlb/Build/Intermediates.noindex/ArchiveIntermediates/???????/InstallationBuildProductsLocation/Applications/???????.app (in target: ???????)
cd /Users/birowsky/Desktop/the-real-frontend/cordova/platforms/ios
export CODESIGN_ALLOCATE=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/codesign_allocate
Signing Identity: "iPhone Developer: Daniel Popeski (29B4H8BSP5)"
Provisioning Profile: "iOS Team Provisioning Profile: com.gotaguydev"
(b127e78b-f124-4f9a-be66-2411c56b73b6)
/usr/bin/codesign --force --sign 2DEE62DC0A8710012CE44EC751490177B7C2467D --entitlements /Users/birowsky/Library/Developer/Xcode/DerivedData/???????-eihflkqaiafhhrgatfbnarfxvrlb/Build/Intermediates.noindex/ArchiveIntermediates/???????/IntermediateBuildFilesPath/???????.build/Release-iphoneos/???????.build/???????.app.xcent --timestamp=none /Users/birowsky/Library/Developer/Xcode/DerivedData/???????-eihflkqaiafhhrgatfbnarfxvrlb/Build/Intermediates.noindex/ArchiveIntermediates/???????/InstallationBuildProductsLocation/Applications/???????.app
/Users/birowsky/Library/Developer/Xcode/DerivedData/???????-eihflkqaiafhhrgatfbnarfxvrlb/Build/Intermediates.noindex/ArchiveIntermediates/???????/InstallationBuildProductsLocation/Applications/???????.app: errSecInternalComponent
Command CodeSign failed with a nonzero exit code
** ARCHIVE FAILED **
The following build commands failed:
CodeSign /Users/birowsky/Library/Developer/Xcode/DerivedData/???????-eihflkqaiafhhrgatfbnarfxvrlb/Build/Intermediates.noindex/ArchiveIntermediates/???????/InstallationBuildProductsLocation/Applications/???????.app
(1 failure)
xcodebuild: Command failed with exit code 65
Run Code Online (Sandbox Code Playgroud)
这是我的build.json
:
{
"ios": {
"debug": {
"developmentTeam": "ABCDEFGHIJKL", …
Run Code Online (Sandbox Code Playgroud) 我在 Cordova CLI 上开发一个项目并在物理 iPhone 上编译应用程序,但在控制台中出现访问控制源错误。
这是消息:
[Error] Origin null is not allowed by Access-Control-Allow-Origin.
[Error] Failed to load resource: Origin null is not allowed by Access-Control-Allow-Origin. (bootstrap.min.css, line 0)
Run Code Online (Sandbox Code Playgroud)
该错误来自本地文件,也来自 ajax。
我的config.xml的配置是:
<?xml version='1.0' encoding='utf-8'?>
<widget android-versionCode="14" defaultlocale="es-ES" id="com..." version="2.0.0" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>TEXT</name>
<description>TEXT</description>
<author email="MYEMAIL" href="MYURL">
MYNAME
</author>
<content src="index.html" />
<access origin="*" />
<allow-navigation href="*" />
<preference name="windows-target-version" value="10.0" />
<preference name="KeyboardDisplayRequiresUserAction" value="false" />
<allow-intent href="http://*/*" />
<allow-intent href="https://*/*" />
<allow-intent href="tel:*" />
<allow-intent href="sms:*" />
<allow-intent …
Run Code Online (Sandbox Code Playgroud) 我正在使用cordova-plugin-file
将一些数据图像保存到用户的 iOS 手机。
saveBlobAsImageFile(folderpath, filename, blob) {
const onError = function(msg) {
// handles error
}
window.resolveLocalFileSystemURL(folderpath, function(dir) {
console.log("Access to the directory granted");
dir.getFile(filename, { create: true }, function(file) {
console.log("File created")
file.createWriter(function(fileWriter) {
fileWriter.write(blob);
console.log("Written file")
}, onError)
}, onError)
}, onError)
}
Run Code Online (Sandbox Code Playgroud)
对于folderpath
,我尝试了所有这 5 个选项:
let folderpath = cordova.file.syncedDataDirectory;
let folderpath1 = cordova.file.documentsDirectory;
let folderpath2 = cordova.file.dataDirectory;
let folderpath3 = cordova.file.cacheDirectory;
let folderpath4 = cordova.file.tempDirectory;
Run Code Online (Sandbox Code Playgroud)
运行该函数后saveBlobAsImageFile
,日志显示写入成功,但是当我在模拟器/iPhone 中转到文件或库时,我找不到任何已保存的文件。
更新:当我在模拟器中运行时,点击保存后,我发现文件保存在这些文件夹中:
file:///Users/ngoctuan001/Library/Developer/CoreSimulator/Devices/2964FE69-A5FE-4516-B8F1-C45488DBE2B5/data/Containers/Data/Application/1EF9FF0C-903E-481F-87A0-9A1CEDA4DE5D/Library/Cloud/
file:///Users/ngoctuan001/Library/Developer/CoreSimulator/Devices/2964FE69-A5FE-4516-B8F1-C45488DBE2B5/data/Containers/Data/Application/1EF9FF0C-903E-481F-87A0-9A1CEDA4DE5D/Documents/
file:///Users/ngoctuan001/Library/Developer/CoreSimulator/Devices/2964FE69-A5FE-4516-B8F1-C45488DBE2B5/data/Containers/Data/Application/1EF9FF0C-903E-481F-87A0-9A1CEDA4DE5D/Library/NoCloud/ …
Run Code Online (Sandbox Code Playgroud) cordova-ios ×12
cordova ×10
ios ×6
ios14 ×2
phonegap ×2
xcode ×2
angular ×1
angular8 ×1
code-signing ×1
inappbrowser ×1
ionic-v1 ×1
mobile ×1
pinchzoom ×1
wkwebview ×1