首页 > 其他分享 >使用ionic2移动应用在IOS中遇到的问题

使用ionic2移动应用在IOS中遇到的问题

时间:2022-11-28 23:36:36浏览次数:59  
标签:Description Privacy iOS App IOS ionic2 Intl Usage 移动


       在公司工作,正在开发一款APP,途中打包成ios安装测试时,发现:

       1、应用在Android中正常运行,在iphone6s中也没有出现什么太大问题(当然我们这里不提运行流畅度的问题),而在低版本的ios中却发现,在首页的菜单 点了居然没有什么反应,而本来应打开新的页面的。一直以为是ionic2在ios低版本的兼容问题。然后在 xcode 中再次打包运行的时候,发现 当我点击某个菜单要进入页面的时候报错了,以至于没有打开新的页面(当然在android中和iphone6s中没出现过)。

使用ionic2移动应用在IOS中遇到的问题_safari

        出现如下错误:ERROR: Unhandled Promise rejection: Can't find variable: Intl;  Zone: angular ; Task: Promise.then ; Value: ReferenceError: Can't find variable: Intrl

        最主要的还是这句 Can't find variable: Intl。当然自己也百思不得其姐,错了,是解。于是 google 了好几下,找到了解决方案,原文如下:

(​​Ionic 2, Using Angular 2 Pipe breaks on iOS—“Can't find variable: Intl”​​)



Ionic 2, Using Angular 2 Pipe breaks on iOS—“Can't find variable: Intl” up vote 15 down vote favorite 2 Experiencing the same problem with the date, percent, and currency pipes when using them in a template—

For example, I'm using a simple percent pipe:

{{ .0237| percent:'1.2-2' }}

It works when running on Chrome, but when I deploy to an iOS device, it throws this error:

"EXCEPTION: ReferenceError: Can't find variable: Intl in [{{ {{ .0237| percent:'1.2-2' }} ..."

Has anyone else run into this problem? Any suggestions or help would be greatly appreciated! Thanks!

ios angularjs ionic-framework angular2 ionic2


2 Answers

That's because it relies on the internalization API, which is not currently available in all browsers (for example not on iOS browser).

See the ​​compatibility table​​.

This is a ​​known issue​​ (beta.1).

You can try to use a ​​polyfill for Intl​​.

To do so, you can use the CDN version, and add this to your index.html:

<script src="https://cdn.polyfill.io/v2/polyfill.min.js?features=Intl.~locale.en"></script>

Or if you use Webpack, you can install the Intl module with NPM:

npm install --save intl

And add these imports to your app:

import 'intl';
import 'intl/locale-data/jsonp/en';




(另一个人的回复)

There is a quick fix for this. Add

<script src="https://cdn.polyfill.io/v2/polyfill.min.js?features=Intl.~locale.en"></script>

​<script src="cordova.js"></script>​

See this github answer ​​https://github.com/angular/angular/issues/3333#issuecomment-203327903​


       解决方案如下:

加入那样的一句话:

使用ionic2移动应用在IOS中遇到的问题_ios_02

       完美解决问题~~~ 23333333


       2、这里还有一个小问题的提示:你在发现当点击某个菜单时,会发现在ios中会有某名的延迟,这样的延迟就好像我们没点到菜单一样,或者点击了没什么反应。以为是ionic2在ios上的性能问题,后来突发奇想将 放置在菜单上的click事件修改为touchstart事件,显然这种延迟就没有了。不妨试试。

(但是,这里仍有个疑问:为啥我看到的教程是使用click事件,却不使用touchstart事件呢?)

** ionic2 中可添加 tappable 属性到元素上避免click事件延迟触发。


3、在ios中iframe加载不了网页的问题(iframe白屏)

  在config.xml中添加:


<!-- ios中iframe加载不了网页的解决方式 -->
<!--<allow-navigation href="*" />
<allow-intent href="*" />
<access origin="*" />-->
<allow-navigation href="*" />

  在index.html文件中添加:


<meta http-equiv="Content-Security-Policy" content="default-src * data: cdvfile: gap:; style-src 'self' 'unsafe-inline'; script-src 'self' 'unsafe-inline' 'unsafe-eval'"/>


4、​​iOS-Xcode上传后iTunes Connect构建版本不显示​​

参考:​​ iOS-Xcode上传后iTunes Connect构建版本不显示​​

解决:在项目中的plist文件中,配置权限说明。


如下方便复制粘贴用: 
麦克风权限: 
Privacy - Microphone Usage Description 是否允许此App使用您的麦克风?

相册权限: 
Privacy - Photo Library Usage Description 是否允许此App访问您的相册?

相机权限: 
Privacy - Camera Usage Description 是否允许此App使用您的相机?

通讯录权限: 
Privacy - Contacts Usage Description 是否允许此App访问您的通讯录?

地理位置权限(后台定位): 
Privacy - Location Always Usage Description 是否允许此App访问您的地理位置?

地理位置权限(前台定位): 
Privacy - Location When In Use Usage Description 是否允许此App访问您的地理位置?

蓝牙权限: 
Privacy - Bluetooth Peripheral Usage Description 是否许允此App使用蓝牙?

日历权限: 
Privacy - Calendars Usage Description 是否允许此App使用日历?

5、提交APP进行审核时,首次被拒,被拒原因如下:

We were required to install the WeChat app before the we could log in via WeChat. Users should be able to log in with WeChat and access their accounts without having to install any additional apps.

Next Steps

If you would like to offer authentication through WeChat, it would be appropriate to use a mechanism that allows users to log in with WeChat from within your app without first having to install an additional app.

We recommend implementing the Safari View Controller API to display web content within your app. The Safari View Controller allows the display of a URL and inspection of the certificate from an embedded browser in an app so that customers can verify the webpage URL and SSL certificate to confirm they are entering their sign in credentials into a legitimate page.

Resources

For additional information on the Safari View Controller API, please see the webpage, ​​​What's New in Safari​​.

解决:

对于iOS应用,考虑到iOS应用商店审核指南中的相关规定,建议开发者接入微信登录时,先检测用户手机是否已安装微信客户端(使用sdk中isWXAppInstalled函数 ),对未安装的用户隐藏微信登录按钮,只提供其他登录方式(比如手机号注册登录、游客登录等)。

对于微信分享的功能,也采用上述类似的方法,对未安装微信的用户隐藏微信的分享功能。


标签:Description,Privacy,iOS,App,IOS,ionic2,Intl,Usage,移动
From: https://blog.51cto.com/u_15894233/5893785

相关文章

  • 骑士的移动(Knight Moves)
    ​​KnightMoves​​TimeLimit:3000MS MemoryLimit:Unknown 64bitIOFormat:%lld&%llu​​Submit ​​​​Status​​Description​​​​Afriendofyou......
  • 在ionic2中自定义服务:该服务需要使用到NavController
        如果在自定义的服务中的constructor中直接注入(NavControlll)privatenavCtrl:NavController,然后再page页面或组件中的constructor中也采用注入的方式,可能会出现......
  • iOS组件化
    ##**Vue组件化与iOS的业务组件化**(模块化)iOS组件化[Modular](https://github.com/gu0315/Modular)##Vue###一.组件化的需求Vue.js的两个核心数据驱动和组件化......
  • ionic2中ThemeableBrowser插件的使用——App内嵌浏览器
    参考:​​ThemeableBrowser​​    需要注意的是低版本的ionic2项目可能无法使用该插件,尽管可以根据官方给出的成功下载好插件,在使用的过程中也会发现不可用的情况:Th......
  • 《Beginning Rust From Novice to Professional》---读书随记(移动语义和复制语义)
    BeginningRustFromNovicetoProfessionalAuthor:CarloMilanesi如果需要电子书的小伙伴,可以留下邮箱,看到了会发送的Chapter21Drops,Moves,andCopiesDeterm......
  • 什么?在ionic2上实现支付宝支付
    参考:​​cordova-plugin-alipay——ionic2支付宝App支付插件,支持Android、iOS​​    在ionic2上实现支付宝支付的功能,需要使用到一个封装好的cordova插件(当然,如果......
  • ionic2实现社会化分享Social Sharing
    SocialSharing插件:​​SocialSharing​​参考:​​phonegap/cordova开发中的分享功能​​    在ionic2项目下,执行如下语句安装插件:$ionicpluginaddcordova-plug......
  • 这回又来个 ionic2 的微信支付!(遇到一些莫名的BUG)
    目录​​目录​​​​ionic2实现微信支付前的准备工作​​​​ionic2中的微信支付​​​ionic2中实现微信支付的参考代码​​客户端APP​​​实现插件的封装WechatPlugints......
  • 我打包发布ionic2 APP正式版的步骤
    目录​​目录​​​​Android平台的apk打包​​​​iOS平台生成构建版本的注意事项​​​Android平台的具体参考​​​Publishingyourapp​​这里进行记录,方便查找:Androi......
  • ionic2 中的网络监测功能
    参考:​​http://ionicframework.com/docs/v2/native/network/​​(后须还将发表其他我正在ionic2使用的插件或功能)增加网络监测功能的cordova插件:$ionicpluginaddcordova......