我应该如何解决该错误:线程1:EXC_RESOURCE RESOURCE_TYPE_MEMORY(限制= 650 MB,未使用= 0x0)? [英] How should I solve this error: Thread 1: EXC_RESOURCE RESOURCE_TYPE_MEMORY (limit=650 MB, unused=0x0)?

查看:576
本文介绍了我应该如何解决该错误:线程1:EXC_RESOURCE RESOURCE_TYPE_MEMORY(限制= 650 MB,未使用= 0x0)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试运行使用以下GitHub项目的应用: https://github.com/PaoloCuscela/Cards/wiki/概述

I am trying to run my app which uses this GitHub project: https://github.com/PaoloCuscela/Cards/wiki/Overview

但是当我在iPhone 6上运行我的应用程序时,它崩溃了,并显示了标题错误.

But when I run my app on my iPhone 6, it crashes and gives me the error in the title.

我已经在我的 viewDidLoad 函数中编写了其中的28个,该应用在模拟器上的运行情况很好.

I've written 28 of these in my viewDidLoad function and the app runs fine on the simulator.

 let tennisCard = CardHighlight(frame: CGRect(x: 67, y: 3362, width: 250, height: 300))
           tennisCard.title = "Exercise 11"
           tennisCard.itemTitle = "Tennis"
           tennisCard.backgroundColor = UIColor(red: 0/255, green: 255/255, blue: 79/255, alpha: 1)
           tennisCard.buttonText = "See"
           tennisCard.itemSubtitle = ""
           tennisCard.tintColor = UIColor.black
           tennisCard.textColor = UIColor.black
           tennisCard.icon = UIImage(named: "Tennis")
           let tennisVC = storyboard?.instantiateViewController(withIdentifier: "TennisCardContent")
                tennisCard.shouldPresent(tennisVC, from: self)
                scrollView.addSubview(tennisCard)

推荐答案

您的应用似乎使用了很多资源.

It seems like your app uses to much resources.

首先,检查您的资产文件是否较大,如果是这种情况,请将其调整为较低的分辨率.

First of all, check if your assets have big file sizes, and if that is the case resize them to a lower resolution.

也将所有这些视图(大多数隐藏在可见区域的下面)立即加载到滚动视图中,这在内存方面效率很低.尝试使用仅在可见时加载这些视图的表视图或集合视图.这也可以帮助您摆脱代码重复

Also loading all of these (mostly hidden below the visible area) views into the scroll view at once is very memory inefficient. Try using a table view or collection view that only loads these views when visible. This could also help you get rid of code duplication

这篇关于我应该如何解决该错误:线程1:EXC_RESOURCE RESOURCE_TYPE_MEMORY(限制= 650 MB,未使用= 0x0)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆