美文网首页
IONIC ios坑

IONIC ios坑

作者: Fat_Bone | 来源:发表于2019-07-26 17:19 被阅读0次

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

相关文章

网友评论

      本文标题:IONIC ios坑

      本文链接:https://www.haomeiwen.com/subject/ofvdrctx.html