IONIC ios坑

Account Info:

开发者账号
hft_apple@esmart365.com
Esmart365.com
1972年03月30日
孙强
安全问题
最好的朋友名字
惠付通
理想的工作
珠海惠付通
上司名字
惠付通科技
注册ID:5PLJ58X247
100414180323
链接:https://developer.apple.com/account/#/enrollment/5PLJ58X247

1、ionic cordova run ios报错:

Code Signing Error: Signing for "HelloWorld" requires a development team. Select a development team in the project editor.

Code Signing Error: Code signing is required for product type 'Application' in SDK 'iOS 11.2'

登录你的开发者账号,在

2、APPLE各类授权证书问题:

http://blog.csdn.net/phunxm/article/details/42685597

3、构建出错

(node:21527) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: Unhandled "error" event. (Parsing /Users/chenyihui/programs/hft-app/platforms/android/res/xml/config.xml failed)

(node:21527) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

降级cordova.

这个问题是由于android的xml目录结构变化引起的,如果是cordova 8.0.0,就会出现此错误,降级至7.1.0或其他相近版本即可。

降级命令:

npm uninstall -g cordova

npm install cordova@7.1.0

4、运行报错

xcrun: error: unable to find utility "PackageApplication", not a developer tool or in PATH

Error: Error code 72 for command: xcrun with args: -sdk,iphoneos,PackageApplication,-v,/Users/chenyihui/programs/hft-app/platforms/ios/build/device/惠智付.app,-o,/Users/chenyihui/programs/hft-app/tforms/ios/build/device/惠智付.ipa

https://github.com/NativeScript/nativescript-cli/issues/2668

5、XCODE运行失败

Thread 1: signal SIGABRT

2017-08-09 12:32:05.492017+0200 Cochrane+[734:238485] *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<WKWebViewConfiguration 0x1701bcd20> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key _requiresUserActionForMediaPlayback.' 

cordova-plugin-background-mode插件有问题。作者尚未更新,另一个大神帮其修复,但尚未pull request。

所以解决方案是卸载cordova-plugin-background-mode,安装cordova-plugin-better-background-mode最新版本即可。

6、通过命令运行ionic cordova run ios --device,报如下错误:

NameError: name 'run_one_line' is not defined

Traceback (most recent call last):

File "<string>", line 1, in <module>

NameError: name 'run_one_line' is not defined

Traceback (most recent call last):

File "<string>", line 1, in <module>

NameError: name 'run_one_line' is not defined

Traceback (most recent call last):

File "<string>", line 1, in <module>

NameError: name 'run_one_line' is not defined

Traceback (most recent call last):

File "<string>", line 1, in <module>

NameError: name 'run_one_line' is not defined

Traceback (most recent call last):

File "<string>", line 1, in <module>

NameError: name 'run_one_line' is not defined

Traceback (most recent call last):

File "<string>", line 1, in <module>

NameError: name 'run_one_line' is not defined

Traceback (most recent call last):

File "<string>", line 1, in <module>

NameError: name 'run_one_line' is not defined

Traceback (most recent call last):

File "<string>", line 1, in <module>

NameError:

name 'run_one_line' is not defined

Traceback (most recent call last):

File "<string>", line 1, in <module>

NameError: name 'run_one_line' is not defined

Traceback (most recent call last):

File "<string>", line 1, in <module>

NameError: name 'run_one_line' is not defined

Current executable set to '/Users/chenyihui/programs/hft-app/platforms/ios/build/device/惠智付.app' (arm64).

(lldb) script fruitstrap_device_app="/private/var/containers/Bundle/Application/816E9023-51AA-43BA-9731-A255C8B22CE4/惠智付.app"

Traceback (most recent call last):

File "<string>", line 1, in <module>

NameError: name 'run_one_line' is not defined

error: python failed attempting to evaluate 'fruitstrap_device_app="/private/var/containers/Bundle/Application/816E9023-51AA-43BA-9731-A255C8B22CE4/惠智付.app"'

原因分析:缺少一个python2/3兼容包,下载https://pypi.python.org/pypi/six/,解压缩,然后在该路径下执行:

$ sudo python setup.py install

7、IOS上所有的对外请求全部变为localhost:8080.....出现跨域问题。

http://uncaughterror.com/programming/ionic3/preflight-response-issue-with-ionic3-app-on-ios-build-only-resolved/

原因:IOS现在全部采用新的webview控件:WKWebView, 取代了UIWebView。UIWebView之前访问其他服务器是没有跨域机制的,WKWebView现在有了。最好的处理方法是,我们所有的API接口都允许跨域请求,如果你没有API的开发权限,一个比较绕的方法是,手动改为旧的UIWebView插件:

先在config.xml里根元素下加上:
<feature name="CDVWKWebViewEngine">
<param name="ios-package" value="CDVWKWebViewEngine" />
</feature>
<preference name="CordovaWebViewEngine" value="CDVWKWebViewEngine" />

然后卸载

ionic cordova plugin remove cordova-plugin-ionic-webview --save

rm -rf platforms/ rm -rf plugins/ ionic cordova build ios

8、IOS模拟器输入框不弹出键盘

模拟器菜单栏上Hardware -> Keyboard -> Connect Hardware Keyboard 取消勾选即可。

9、打生产包报错:

2017-09-21 07:37:16.787 xcodebuild[70400:217569] [MT] IDEDistribution: -[IDEDistributionLogging _createLoggingBundleAtPath:]: Created bundle at path '/var/folders/wj/yj3cfvh954gbc_btlhcrcx7nk7t4dj/T/App Name_2017-09-21_07-37-16.786.xcdistributionlogs'. 2017-09-21 07:37:16.938 xcodebuild[70400:217569] [MT] IDEDistribution: Step failed: <IDEDistributionSigningAssetsStep: 0x7ff756bbdf70>: Error Domain=IDEDistributionSigningAssetStepErrorDomain Code=0 "Locating signing assets failed." UserInfo={NSLocalizedDescription=Locating signing assets failed., IDEDistributionSigningAssetStepUnderlyingErrors=( "Error Domain=IDEProvisioningErrorDomain Code=9 \"\"App Name.app\" requires a provisioning profile.\" UserInfo={NSLocalizedDescription=\"App Name.app\" requires a provisioning profile., NSLocalizedRecoverySuggestion=Add a profile to the \"provisioningProfiles\" dictionary in your Export Options property list.}" )} error: exportArchive: "App Name.app" requires a provisioning profile. Error Domain=IDEProvisioningErrorDomain Code=9 ""App Name.app" requires a provisioning profile." UserInfo={NSLocalizedDescription="App Name.app" requires a provisioning profile., NSLocalizedRecoverySuggestion=Add a profile to the "provisioningProfiles" dictionary in your Export Options property list.} ** EXPORT FAILED ** Error: Error code 70 for command: xcodebuild with args: -exportArchive,-archivePath,App Name.xcarchive,-exportOptionsPlist,/Users/Shared/Workspace/github/AppName/platforms/ios/exportOptions.plist,-exportPath,/Users/Shared/Workspace/github/AppName/platforms/ios/build/device

[https://stackoverflow.com/questions/46344443/after-upgrading-to-xcode-9-cordova-app-wont-build-error-70-requires-provisio/46370957#46370957](https://stackoverflow.com/questions/46344443/after-upgrading-to-xcode-9-cordova-app-wont-build-error-70-requires-provisio/46370957#46370957)

build.json文件添加

<pre>"ios": {
"debug": {
"codeSignIdentitiy": "iPhone Developer",
"developmentTeam":"SYN63VH22P",
"packageType": "developer",
"iCloudContainerEnvironment": "Development"
},
"release": {
"codeSignIdentitiy": "iPhone Distribution",
"developmentTeam":"SYN63VH22P",
"provisioningProfile": "20180906",
"packageType": "app-store",z
"iCloudContainerEnvironment": "Production"
}
}</pre>

10、IOS审核拒绝:

Guideline 5.1.1 - Legal - Privacy - Data Collection and Storage

We noticed that your app requests the user’s consent to access their camera but does not clarify the use of this feature in the permission modal alert.

Next Steps

To resolve this issue, please revise the permission modal alert to specify why the app is requesting access to the user's camera.

The permission request alert should specify how your app will use this feature to help users understand why your app is requesting access to their personal data.

Resources

For additional information and instructions on configuring and presenting an alert, please review the Requesting Permission section of the iOS Human Interface Guidelines and the Information Property List Key Reference. You may also want to review the Technical Q&A QA1937: Resolving the Privacy-Sensitive Data App Rejection page for details on how to provide a usage description for permission request alerts.

Learn more about Protecting the User’s Privacy.

Please see attached screenshots for details.

数据隐私相关,在打开相机前必须弹出一个自定义的与产品相关的授权问询,新版相机插件已经提供解决方案:

iOS quirks

Since iOS 10 it's mandatory to add a NSCameraUsageDescription in the Info.plist.

NSCameraUsageDescription describes the reason that the app accesses the user's camera. When the system prompts the user to allow access, this string is displayed as part of the dialog box. If you didn't provide the usage description, the app will crash before showing the dialog. Also, Apple will reject apps that access private data but don't provide an usage description.

To add this entry you can use the edit-config tag in the config.xml like this:

<edit-config target="NSCameraUsageDescription" file="*-Info.plist" mode="merge">
    <string>To scan barcodes</string>
</edit-config>

<pre><platform name="ios">
标签下加入上述配置</pre>

11、运行时报错crash

dyld: Library not loaded: @rpath/libswiftAVFoundation.dylib

Referenced from: /var/containers/Bundle/Application/5EFB8BC2-AFED-4619-8177-6ACFF33FD2E8/惠智付.app/惠智付

Reason: no suitable image found. Did find:

/private/var/containers/Bundle/Application/5EFB8BC2-AFED-4619-8177-6ACFF33FD2E8/惠智付.app/Frameworks/libswiftAVFoundation.dylib: code signing blocked mmap() of '/private/var/containers/Bundle/Application/5EFB8BC2-AFED-4619-8177-6ACFF33FD2E8/惠智付.app/Frameworks/libswiftAVFoundation.dylib'

(lldb)

可能的方案:https://stackoverflow.com/questions/46747801/dyld-library-not-loaded-rpath-libswiftavfoundation-dylib-reason-image-not-fo

12、dyld: could not load inserted library: /usr/lib/libgmalloc.dylib

Guard Malloc是用来检测XEC_BAD_ACCESS,EXC_BAD_INSTRUCTION错误,一般调试时可以打开这个选项。
有时打开这个设置,运行程序出错:
dyld: could not load inserted library: /usr/lib/libgmalloc.dylib
解决方案:
菜单-->Product--->EditScheme, 关闭 Guard Malloc!

如果还不行,要把keychain里所有APPLE相关的证书里的信任都要设为系统默认!!

作者:wonwinry
链接:https://www.jianshu.com/p/8ad85b804322
來源:简书
简书著作权归作者所有,任何形式的转载都请联系作者获得授权并注明出处。

13、引入外部swift包后,提交生产包,苹果发了一封邮件到我们邮箱里:

<colgroup><col></colgroup>
|

|

image

|
| |
|

Dear Developer,

We identified one or more issues with a recent delivery for your app, "惠智付". Please correct the following issues, then upload again.

Invalid Swift Support - The files libswiftDarwin.dylib, libswiftAssetsLibrary.dylib, libswiftMetal.dylib, libswiftCoreAudio.dylib, libswiftsimd.dylib, libswiftQuartzCore.dylib, libswiftos.dylib, libswiftObjectiveC.dylib, libswiftDispatch.dylib, libswiftCoreLocation.dylib, libswiftCoreGraphics.dylib, libswiftCoreData.dylib, libswiftCoreFoundation.dylib, libswiftUIKit.dylib, libswiftCoreMedia.dylib, libswiftAVFoundation.dylib, libswiftCore.dylib, libswiftFoundation.dylib, libswiftPhotos.dylib, libswiftCoreImage.dylib aren’t at the expected location /Payload/惠智付.app/Frameworks. Move the file to the expected location, rebuild your app using the current public (GM) version of Xcode, and resubmit it.

Best regards,

The App Store Team

|

|

[图片上传失败...(image-635ae4-1564132726577)]

我把类库加到framework目录下就可以。

14、

Guideline 2.5.4 - Performance - Software Requirements

Your app declares support for audio in the UIBackgroundModes key in your Info.plist but did not include features that require persistent audio.

Next Steps

The audio key is intended for use by apps that provide audible content to the user while in the background, such as music player or streaming audio apps. Please revise your app to provide audible content to the user while the app is in the background or remove the "audio" setting from the UIBackgroundModes key.

[图片上传失败...(image-8bdfa1-1564132726577)]

15、error: archive not found at path '/Users/chenyihui/programs/hft-app/platforms/ios/惠智付.xcarchive'

https://stackoverflow.com/questions/52281848/cordova-build-ios-error-archive-not-found-at-path-path-to-myapp-xcarchive

16、

    CompileSwiftSources normal arm64 com.apple.xcode.tools.swift.compiler

    CompileSwift normal arm64 /Users/chenyihui/programs/hft-app/platforms/ios/惠智付/Plugins/cordova-plugin-photo-library/PhotoLibraryService.swift

[图片上传失败...(image-7db39c-1564132726577)]

17、应用在安卓上跑得好好的,在iOS上所有的插件都不起作用,除非APP切到后台再打开,插件才起作用。比如,一个按钮打开摄像头,一开始没反应,home回桌面后,再次进入APP,摄像头在那开着。splash也是。

https://stackoverflow.com/questions/38410159/cordova-app-hanging-during-startup-on-ios-10

生产包代码:export NODE_ENV=prod&&ionic cordova build ios --release --buildFlag='-UseModernBuildSystem=0' (Windows:set NODE_ENV=prod&&ionic cordova build ios --release

记得修改访问隐私提示语

Privacy - Photo Library Usage Description : 尊敬的用户,为了更好的使用本应用,向您请求授权使用图库,以便我们可以获得您的图像资料来丰富您的个人信息,如门头照,收款码等。

e

©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 159,716评论 4 364
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 67,558评论 1 294
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 109,431评论 0 244
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 44,127评论 0 209
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 52,511评论 3 287
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 40,692评论 1 222
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 31,915评论 2 313
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 30,664评论 0 202
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 34,412评论 1 246
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 30,616评论 2 245
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 32,105评论 1 260
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 28,424评论 2 254
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 33,098评论 3 238
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 26,096评论 0 8
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 26,869评论 0 197
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 35,748评论 2 276
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 35,641评论 2 271

推荐阅读更多精彩内容