Ionic 5 iOS 应用程序在加载过多图像时重新启动
Ionic 5 iOS app restarts when too many images are loaded
希望大家度过愉快的一天。
这是一笔交易,每当我从 API 加载很多产品时,每个产品都有一个图像,应用程序会重新启动,并从头加载。
一开始是使用简单的 <img>
标签,我将其更改为 ion-img
,我发现使用 ion-img
标签有很大的不同,因为它延迟加载图片。
但是,当我加载了超过 40-60 个产品并加载了这些图片时,应用程序仍然会刷新。
我删除了图片,没有显示图片,应用程序运行正常,但应用程序需要这些图片。
这可能是什么问题?我错过了什么吗?
Click Here for Streamable 1 video
这里客户想看产品分类,里面有很多产品
Click here for Streamable 2 video.
这里客户想要 select 一个产品,但是当它这样做时,应用程序会重新启动。
第二个视频是我尝试过的,删除前 15 个产品,当获得下一个 15 个无限滚动时,但因此发生了滚动。
这是离子信息:
Ionic:
Ionic CLI : 6.12.3 (/Users/leotrinelmazi/.nvm/versions/node/v12.19.0/lib/node_modules/@ionic/cli)
Ionic Framework : @ionic/angular 5.5.1
@angular-devkit/build-angular : 0.1000.8
@angular-devkit/schematics : 10.0.8
@angular/cli : 10.0.8
@ionic/angular-toolkit : 2.3.3
Cordova:
Cordova CLI : 10.0.0
Cordova Platforms : ios 6.1.1
Cordova Plugins : cordova-plugin-ionic-keyboard 2.2.0, cordova-plugin-ionic-webview 4.2.1, (and 11 other plugins)
Utility:
cordova-res (update available: 0.15.2) : 0.15.1
native-run (update available: 1.3.0) : 1.2.1
System:
ios-deploy : 1.11.3
ios-sim : 8.0.2
NodeJS : v12.19.0 (/Users/leotrinelmazi/.nvm/versions/node/v12.19.0/bin/node)
npm : 6.14.8
OS : macOS Catalina
Xcode : Xcode 12.3 Build version 12C33
这是我用来展示产品和图片的 HTML 的简短代码。
<ion-grid style="margin: 10px;" class="ion-no-padding" *ngIf="data.length < 1">
<div *ngFor="let sub of allData">
<ion-row *ngIf="sub.products && sub.products.length > 0">
<ion-col size="12">
<ion-item lines="none">
<div slot="start" style="text-transform: uppercase;
font-weight: bold;
font-size: 25px;">{{sub.title}}</div>
<ion-button slot="end" (click)="goToShowAll()"size="small" fill="outline" class="seeAllButtonClass"><span style="margin: 10px;">voir tout</span></ion-button>
</ion-item>
</ion-col>
<ion-col size-xs="6" *ngFor="let prods of sub.products">
<div class="products-scroll">
<div>
<ion-card (click)="goToDetail(prods)">
<ion-img class="img" src="{{prods.image}}" alt=""></ion-img>
<div class="diviParagrafit">
<p>
{{prods.price}}<small>{{this.webService.config.currency}}</small>
</p>
<p>
{{prods.title}}
</p>
</div>
</ion-card>
</div>
</div>
</ion-col>
</ion-row>
</div>
</ion-grid>
这是我在 XCODE 上遇到 crash/restart 时出现的错误:
2021-01-27 10:46:23.249648+0100 ModaPasCher[4808:3587108] [ProcessSuspension] 0x104aa9600 - ProcessAssertion: Failed to acquire RBS Background assertion 'ConnectionTerminationWatchdog' for process because PID is invalid
2021-01-27 10:46:23.250462+0100 ModaPasCher[4808:3587108] [Process] 0x10d02b418 - [pageProxyID=6, webPageID=7, PID=5068] WebPageProxy::processDidTerminate: (pid 5068), reason 3
2021-01-27 10:46:23.258873+0100 ModaPasCher[4808:3587108] [assertion] Error acquiring assertion: <Error Domain=RBSAssertionErrorDomain Code=3 "Target is not running or required target entitlement is missing" UserInfo={RBSAssertionAttribute=<RBSDomainAttribute| domain:"com.apple.webkit" name:"Background" sourceEnvironment:"(null)">, NSLocalizedFailureReason=Target is not running or required target entitlement is missing}>
2021-01-27 10:46:23.258990+0100 ModaPasCher[4808:3587108] [ProcessSuspension] 0x104aa9640 - ProcessAssertion: Failed to acquire RBS Background assertion 'WebProcess Background Assertion' for process with PID 5068, error: Error Domain=RBSAssertionErrorDomain Code=3 "Target is not running or required target entitlement is missing" UserInfo={RBSAssertionAttribute=<RBSDomainAttribute| domain:"com.apple.webkit" name:"Background" sourceEnvironment:"(null)">, NSLocalizedFailureReason=Target is not running or required target entitlement is missing}
2021-01-27 10:46:23.270927+0100 ModaPasCher[4808:3587108] [Loading] 0x10d02b418 - [pageProxyID=6, webPageID=7, PID=5068] WebPageProxy::dispatchProcessDidTerminate: reason = 3
2021-01-27 10:46:24.568454+0100 ModaPasCher[4808:3587108] {"id":1,"admin_id":1,"company_name":"Moda Pas Cher","logo":"https://modapascher.com/storage/images/1/logo/logo.png","admin_theme":"blush","about_desc":null,"address":"France","main_email":"info@modapascher.com","tel":null,"hotline_support":1,"hotline_num":"075976979,3599785748,486845648","shipping_fee":"8.00","min_o_free":"0.00","processing_fee":"0.00","currency":"€","cash_payment":0,"shipping_type":1,"privacy_policy":null,"terms_condition":null,"status":1,"facebook":"https://www.facebook.com/ModaPasCherFR/videos/?ref=page_internal","twitter":null,"instagram":"https://www.instagram.com/modapascher/","created_at":"2020-08-31T06:54:23.000000Z","updated_at":"2021-01-26T13:51:15.000000Z"}
2021-01-27 10:46:24.568628+0100 ModaPasCher[4808:3587108] Ionic Native: deviceready event fired after 385 ms
2021-01-27 10:46:24.569162+0100 ModaPasCher[4808:3587108] initializing
2021-01-27 10:46:24.572560+0100 ModaPasCher[4808:3587108] OPEN database: _ionicstorage
2021-01-27 10:46:24.572763+0100 ModaPasCher[4808:3587108] new transaction is queued, waiting for open operation to finish
2021-01-27 10:46:24.572905+0100 ModaPasCher[4808:3810022] -[SQLitePlugin closeNow:] [Line 237] close db name: _ionicstorage
2021-01-27 10:46:24.609135+0100 ModaPasCher[4808:3810287] [Client] Updating selectors after delegate removal failed with: Error Domain=NSCocoaErrorDomain Code=4099 "The connection to service on pid 87 named com.apple.commcenter.coretelephony.xpc was invalidated from this process." UserInfo={NSDebugDescription=The connection to service on pid 87 named com.apple.commcenter.coretelephony.xpc was invalidated from this process.}
2021-01-27 10:46:24.634035+0100 ModaPasCher[4808:3810022] -[SQLitePlugin openNow:] [Line 176] open full db path: /var/mobile/Containers/Data/Application/2C4C0F50-3329-4F3D-8623-5666F98DC108/Library/LocalDatabase/_ionicstorage
2021-01-27 10:46:24.645036+0100 ModaPasCher[4808:3587108] OPEN database: _ionicstorage - OK
2021-01-27 10:46:24.645193+0100 ModaPasCher[4808:3587108] DB opened: _ionicstorage
2021-01-27 10:46:24.698638+0100 ModaPasCher[4808:3587108] The preference key "AutoHideSplashScreen" is not defined and will default to "TRUE"
2021-01-27 10:46:24.780668+0100 ModaPasCher[4808:3810022] Request <OSRequestRegisterUser: 0x283d8be70> success result {
id = "0008ce03-34fc-474c-bb1b-a1b211524dec";
success = 1;
}
2021-01-27 10:46:53.251675+0100 ModaPasCher[4808:3587108] Could not signal service com.apple.WebKit.WebContent: 113: Could not find specified service
非常感谢。
当您尝试在浏览器中 运行 时会发生什么?结果相同?
您可能需要使用 ion-virtual-scroll 来处理内存管理。请特别注意有关 iOS 和 wkWebView 的文档。
问题是 HTML TAG <ion-card>
。
在我删除该标签并将其替换为 <ion-grid>
之后,在 iOS 上一切正常。
但是,谢谢你让我知道 ion-virtual-scroll
@E。 maginni ,我会尝试一下,以后会用到。
希望大家度过愉快的一天。
这是一笔交易,每当我从 API 加载很多产品时,每个产品都有一个图像,应用程序会重新启动,并从头加载。
一开始是使用简单的 <img>
标签,我将其更改为 ion-img
,我发现使用 ion-img
标签有很大的不同,因为它延迟加载图片。
但是,当我加载了超过 40-60 个产品并加载了这些图片时,应用程序仍然会刷新。
我删除了图片,没有显示图片,应用程序运行正常,但应用程序需要这些图片。
这可能是什么问题?我错过了什么吗?
Click Here for Streamable 1 video
这里客户想看产品分类,里面有很多产品
Click here for Streamable 2 video.
这里客户想要 select 一个产品,但是当它这样做时,应用程序会重新启动。
第二个视频是我尝试过的,删除前 15 个产品,当获得下一个 15 个无限滚动时,但因此发生了滚动。
这是离子信息:
Ionic:
Ionic CLI : 6.12.3 (/Users/leotrinelmazi/.nvm/versions/node/v12.19.0/lib/node_modules/@ionic/cli)
Ionic Framework : @ionic/angular 5.5.1
@angular-devkit/build-angular : 0.1000.8
@angular-devkit/schematics : 10.0.8
@angular/cli : 10.0.8
@ionic/angular-toolkit : 2.3.3
Cordova:
Cordova CLI : 10.0.0
Cordova Platforms : ios 6.1.1
Cordova Plugins : cordova-plugin-ionic-keyboard 2.2.0, cordova-plugin-ionic-webview 4.2.1, (and 11 other plugins)
Utility:
cordova-res (update available: 0.15.2) : 0.15.1
native-run (update available: 1.3.0) : 1.2.1
System:
ios-deploy : 1.11.3
ios-sim : 8.0.2
NodeJS : v12.19.0 (/Users/leotrinelmazi/.nvm/versions/node/v12.19.0/bin/node)
npm : 6.14.8
OS : macOS Catalina
Xcode : Xcode 12.3 Build version 12C33
这是我用来展示产品和图片的 HTML 的简短代码。
<ion-grid style="margin: 10px;" class="ion-no-padding" *ngIf="data.length < 1">
<div *ngFor="let sub of allData">
<ion-row *ngIf="sub.products && sub.products.length > 0">
<ion-col size="12">
<ion-item lines="none">
<div slot="start" style="text-transform: uppercase;
font-weight: bold;
font-size: 25px;">{{sub.title}}</div>
<ion-button slot="end" (click)="goToShowAll()"size="small" fill="outline" class="seeAllButtonClass"><span style="margin: 10px;">voir tout</span></ion-button>
</ion-item>
</ion-col>
<ion-col size-xs="6" *ngFor="let prods of sub.products">
<div class="products-scroll">
<div>
<ion-card (click)="goToDetail(prods)">
<ion-img class="img" src="{{prods.image}}" alt=""></ion-img>
<div class="diviParagrafit">
<p>
{{prods.price}}<small>{{this.webService.config.currency}}</small>
</p>
<p>
{{prods.title}}
</p>
</div>
</ion-card>
</div>
</div>
</ion-col>
</ion-row>
</div>
</ion-grid>
这是我在 XCODE 上遇到 crash/restart 时出现的错误:
2021-01-27 10:46:23.249648+0100 ModaPasCher[4808:3587108] [ProcessSuspension] 0x104aa9600 - ProcessAssertion: Failed to acquire RBS Background assertion 'ConnectionTerminationWatchdog' for process because PID is invalid
2021-01-27 10:46:23.250462+0100 ModaPasCher[4808:3587108] [Process] 0x10d02b418 - [pageProxyID=6, webPageID=7, PID=5068] WebPageProxy::processDidTerminate: (pid 5068), reason 3
2021-01-27 10:46:23.258873+0100 ModaPasCher[4808:3587108] [assertion] Error acquiring assertion: <Error Domain=RBSAssertionErrorDomain Code=3 "Target is not running or required target entitlement is missing" UserInfo={RBSAssertionAttribute=<RBSDomainAttribute| domain:"com.apple.webkit" name:"Background" sourceEnvironment:"(null)">, NSLocalizedFailureReason=Target is not running or required target entitlement is missing}>
2021-01-27 10:46:23.258990+0100 ModaPasCher[4808:3587108] [ProcessSuspension] 0x104aa9640 - ProcessAssertion: Failed to acquire RBS Background assertion 'WebProcess Background Assertion' for process with PID 5068, error: Error Domain=RBSAssertionErrorDomain Code=3 "Target is not running or required target entitlement is missing" UserInfo={RBSAssertionAttribute=<RBSDomainAttribute| domain:"com.apple.webkit" name:"Background" sourceEnvironment:"(null)">, NSLocalizedFailureReason=Target is not running or required target entitlement is missing}
2021-01-27 10:46:23.270927+0100 ModaPasCher[4808:3587108] [Loading] 0x10d02b418 - [pageProxyID=6, webPageID=7, PID=5068] WebPageProxy::dispatchProcessDidTerminate: reason = 3
2021-01-27 10:46:24.568454+0100 ModaPasCher[4808:3587108] {"id":1,"admin_id":1,"company_name":"Moda Pas Cher","logo":"https://modapascher.com/storage/images/1/logo/logo.png","admin_theme":"blush","about_desc":null,"address":"France","main_email":"info@modapascher.com","tel":null,"hotline_support":1,"hotline_num":"075976979,3599785748,486845648","shipping_fee":"8.00","min_o_free":"0.00","processing_fee":"0.00","currency":"€","cash_payment":0,"shipping_type":1,"privacy_policy":null,"terms_condition":null,"status":1,"facebook":"https://www.facebook.com/ModaPasCherFR/videos/?ref=page_internal","twitter":null,"instagram":"https://www.instagram.com/modapascher/","created_at":"2020-08-31T06:54:23.000000Z","updated_at":"2021-01-26T13:51:15.000000Z"}
2021-01-27 10:46:24.568628+0100 ModaPasCher[4808:3587108] Ionic Native: deviceready event fired after 385 ms
2021-01-27 10:46:24.569162+0100 ModaPasCher[4808:3587108] initializing
2021-01-27 10:46:24.572560+0100 ModaPasCher[4808:3587108] OPEN database: _ionicstorage
2021-01-27 10:46:24.572763+0100 ModaPasCher[4808:3587108] new transaction is queued, waiting for open operation to finish
2021-01-27 10:46:24.572905+0100 ModaPasCher[4808:3810022] -[SQLitePlugin closeNow:] [Line 237] close db name: _ionicstorage
2021-01-27 10:46:24.609135+0100 ModaPasCher[4808:3810287] [Client] Updating selectors after delegate removal failed with: Error Domain=NSCocoaErrorDomain Code=4099 "The connection to service on pid 87 named com.apple.commcenter.coretelephony.xpc was invalidated from this process." UserInfo={NSDebugDescription=The connection to service on pid 87 named com.apple.commcenter.coretelephony.xpc was invalidated from this process.}
2021-01-27 10:46:24.634035+0100 ModaPasCher[4808:3810022] -[SQLitePlugin openNow:] [Line 176] open full db path: /var/mobile/Containers/Data/Application/2C4C0F50-3329-4F3D-8623-5666F98DC108/Library/LocalDatabase/_ionicstorage
2021-01-27 10:46:24.645036+0100 ModaPasCher[4808:3587108] OPEN database: _ionicstorage - OK
2021-01-27 10:46:24.645193+0100 ModaPasCher[4808:3587108] DB opened: _ionicstorage
2021-01-27 10:46:24.698638+0100 ModaPasCher[4808:3587108] The preference key "AutoHideSplashScreen" is not defined and will default to "TRUE"
2021-01-27 10:46:24.780668+0100 ModaPasCher[4808:3810022] Request <OSRequestRegisterUser: 0x283d8be70> success result {
id = "0008ce03-34fc-474c-bb1b-a1b211524dec";
success = 1;
}
2021-01-27 10:46:53.251675+0100 ModaPasCher[4808:3587108] Could not signal service com.apple.WebKit.WebContent: 113: Could not find specified service
非常感谢。
当您尝试在浏览器中 运行 时会发生什么?结果相同?
您可能需要使用 ion-virtual-scroll 来处理内存管理。请特别注意有关 iOS 和 wkWebView 的文档。
问题是 HTML TAG <ion-card>
。
在我删除该标签并将其替换为 <ion-grid>
之后,在 iOS 上一切正常。
但是,谢谢你让我知道 ion-virtual-scroll
@E。 maginni ,我会尝试一下,以后会用到。