来自调试器的 Ios Xcode 消息:由于内存问题而终止

2024-02-23

我有一个带有集合视图的应用程序,以及此集合视图中的一个单元格,该单元格重定向到外部链接。

每当该链接打开时,应用程序就会在后台崩溃并在调试器上显示:

“由于内存问题而终止”。

如果我只按主页按钮,应用程序就会继续正常工作。

if (UIDeviceOrientationIsLandscape([UIDevice currentDevice].orientation)) Portrait = NO;
else if (UIDeviceOrientationIsPortrait([UIDevice currentDevice].orientation)) Portrait = YES;
else Portrait = [self getStatusBarOrientations];

if(indexPath.row == 4 && indexPath.section == 0)
{
    NewsListCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"Cell4"  forIndexPath:indexPath];

    if ([languageID isEqualToString:@"1025"])
    {
        cell.title.text =[NSString stringWithFormat:@"جريدة اليوم %@", [self.pdfCoverDict valueForKey:@"PdfDate"]];
        [cell.contentView setTransform:CGAffineTransformMakeScale(-1, 1)];
    } else {
        cell.title.text =[NSString stringWithFormat:@"Today's Edition %@", [self.pdfCoverDict valueForKey:@"PdfDate"]];
    }
    NSURL *imageUrl = [NSURL URLWithString:[self.pdfCoverDict valueForKey:@"CoverImage"]];
    [cell.imageView sd_setImageWithURL:imageUrl];
    cell.imageViewWidth.constant = Portrait ? 246 : 331;
    cell.imageViewHeight.constant = Portrait ? 350 : 471;
    return cell;

} else if(indexPath.row == 0) {
    NewsListCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"HeaderView" forIndexPath:indexPath];
    cell.title.text = [self.channelKeys objectAtIndex:indexPath.section];
    cell.backView.hidden = [channelID isEqualToString:@"1"] ? (indexPath.section == 0 ? YES : NO) : YES;
    if([languageID isEqualToString:@"1025"]) {
        [cell.contentView setTransform:CGAffineTransformMakeScale(-1, 1)];
    } else {
        [cell.contentView setTransform:CGAffineTransformMakeScale(-1, 1)];
        [cell.title setTransform:CGAffineTransformMakeScale(-1, 1)];
    }
    return cell;
} else {

    NSInteger row;
    if(indexPath.row != 1 && indexPath.row != 2 && indexPath.row != 3) {
        row = indexPath.row - 2;
    } else {
        row = indexPath.row - 1;
    }
    NSMutableArray * articles =  [self.channelArticles valueForKey:[self.channelKeys objectAtIndex:indexPath.section]];
     //        if(row < articles.count) {
    NSString *articleImage = [[articles objectAtIndex:row] valueForKey:@"ArticleMedia"];
    NSString *cellIdentifier;
    NSString *articleLangID = [NSString stringWithFormat:@"%@", [[articles objectAtIndex:row] valueForKey:@"LanguageID"]];

    if(indexPath.section == 0) {
        switch (indexPath.row)
        {
            case 1:
                if(![articleImage isEqualToString:@""]) cellIdentifier = @"Cell1";
                else cellIdentifier = @"CellNoImg";
                break;
            case 2:
                if(![articleImage isEqualToString:@""]) cellIdentifier = @"Cell2";
                else cellIdentifier = @"CellNoImg";
                break;
            case 3:
                if(![articleImage isEqualToString:@""]) cellIdentifier = @"Cell3";
                else cellIdentifier = @"CellNoImg";
                break;
            case 5:
                if(![articleImage isEqualToString:@""]) cellIdentifier = @"Cell5";
                else cellIdentifier = @"CellNoImg";
                break;
            case 6:
                if(![articleImage isEqualToString:@""]) cellIdentifier = @"Cell5";
                else cellIdentifier = @"CellNoImg";
                break;
            default:
                if(![articleImage isEqualToString:@""]) {
                    if([channelID isEqualToString:@"1"]) cellIdentifier = @"Cell6";
                    else cellIdentifier = @"Cell5";
                } else {
                    cellIdentifier = @"CellNoImg";
                }
                break;
        }
    } else {
        if(![articleImage isEqualToString:@""]) cellIdentifier = @"Cell5";
        else cellIdentifier = @"CellNoImg";
    }


    NewsListCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:cellIdentifier forIndexPath:indexPath];

    if([[[articles objectAtIndex:row] valueForKey:@"LabelName"] isEqualToString:@""]) {
        cell.labelNameHeight.constant = 0;
    } else {
        cell.labelNameHeight.constant = 21;
    }
    cell.labelName.text = [[articles objectAtIndex:row] valueForKey:@"LabelName"];

    cell.title.text = [[articles objectAtIndex:row] valueForKey:@"MainHeadline"];

    if(indexPath.row == 3 && indexPath.section == 0) {
        if(![articleImage isEqualToString:@""]) cell.titleHeight.constant = [self lineCountForLabel:cell.title labelWidth:cell.frame.size.width - Portrait ? 254 : 337] * 35;
        else cell.titleHeight.constant = [self lineCountForLabel:cell.title labelWidth:cell.frame.size.width - 10] * 35;
    } else {
        cell.titleHeight.constant = [self lineCountForLabel:cell.title labelWidth:cell.frame.size.width - 10] * 35;
    }

    NSString *authorTime = [self getAuthorTime:[articles objectAtIndex:row]];
    if([authorTime isEqualToString:@""]) {
        cell.authorTimeHeight.constant = 0;
    } else {
        cell.authorTimeHeight.constant = 21;
    }
    cell.authorTime.text = authorTime;

    NSString *details = [[articles objectAtIndex:row] valueForKey:@"Introduction"];
    cell.details.attributedText = [self getAttributedString: details language: articleLangID];

    if([cellIdentifier isEqualToString:@"CellNoImg"]) {
        defaultLines = 5;
        if([cell.authorTime.text isEqualToString:@""]) defaultLines++;
        if([cell.labelName.text isEqualToString:@""]) defaultLines++;
        if(cell.titleHeight.constant / 35 == 1) defaultLines++;
        cell.details.numberOfLines = defaultLines;
    }

    if(indexPath.section == 0) {
        switch (indexPath.row)
        {
            case 2:
                cell.imageViewWidth.constant = Portrait ? 240 : 323;
                cell.imageViewHeight.constant = Portrait ? 151 : 199;
                break;
            case 3:
                cell.imageViewWidth.constant = Portrait ? 240 : 323;
                cell.imageViewHeight.constant = Portrait ? 151 : 199;
            case 5:
                cell.imageViewWidth.constant = Portrait ? 240 : 323;
                cell.imageViewHeight.constant = Portrait ? 151 : 199;
                break;
            case 6:
                cell.imageViewWidth.constant = Portrait ? 240 : 323;
                cell.imageViewHeight.constant = Portrait ? 151 : 199;
                break;
            default:
                cell.imageViewWidth.constant = Portrait ? 240 : 323;
                cell.imageViewHeight.constant = Portrait ? 151 : 199;
                break;
        }
    } else {
        cell.imageViewWidth.constant = Portrait ? 240 : 323;
        cell.imageViewHeight.constant = Portrait ? 151 : 199;
    }

    if (![articleImage isEqualToString:@""]) {
        NSURL *imageUrl = [NSURL URLWithString:articleImage];
        [cell.imageView sd_setImageWithURL:imageUrl];

    } else {
        [cell.imageView sd_setImageWithURL:nil];
    }

    if([articleLangID isEqualToString:@"1025"]) {
        [cell.contentView setTransform:CGAffineTransformMakeScale(-1, 1)];
        cell.labelName.textAlignment = NSTextAlignmentRight;
        cell.title.textAlignment = NSTextAlignmentRight;
        cell.authorTime.textAlignment = NSTextAlignmentRight;
        cell.details.textAlignment = NSTextAlignmentRight;
    } else {
        if (indexPath.row == 3) {
            [cell.contentView setTransform:CGAffineTransformMakeScale(-1, 1)];
            [cell.labelName setTransform:CGAffineTransformMakeScale(-1, 1)];
            [cell.title setTransform:CGAffineTransformMakeScale(-1, 1)];
            [cell.authorTime setTransform:CGAffineTransformMakeScale(-1, 1)];
            [cell.details setTransform:CGAffineTransformMakeScale(-1, 1)];
            [cell.imageView setTransform:CGAffineTransformMakeScale(-1, 1)];
        }
        cell.labelName.textAlignment = NSTextAlignmentLeft;
        cell.title.textAlignment = NSTextAlignmentLeft;
        cell.authorTime.textAlignment = NSTextAlignmentLeft;
        cell.details.textAlignment = NSTextAlignmentLeft;
    }
    return cell;

}

}


这是在什么设备上发生的?一旦您的应用程序进入后台,您就可以随时终止它 - 它不必使用过多的内存。

如果新的前台应用程序需要更多内存,操作系统将提供尽可能多的内存。它将向任何后台应用程序发送内存警告。如果它们不通过减少内存占用来做出响应,或者前台应用程序仍然需要更多内存,则后台应用程序将被终止。

您的应用程序没有崩溃,而是被操作系统杀死,因为它不再是前台应用程序,并且其他地方需要它的资源。

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

来自调试器的 Ios Xcode 消息:由于内存问题而终止 的相关文章

  • 无需越狱即可检测iOS9上哪个应用程序处于前台

    我正在尝试记录用户在 iOS9 上的个人应用程序使用情况 我宁愿它不会使用越狱有限的解决方案 不言自明 在越狱手机上执行此应用程序的变体应该不难 https www andyibanez com create mobilesubstrate
  • 如何将自定义 C 代码放入 SwiftPM 包中?

    我正在尝试将 C 代码打包到 Swift 模块中 我们称之为CModule 一旦我将其放入项目的基本文件夹中 Swift模块 并配置了搜索路径 我可以在 Swift 文件中自动完成工作 并检测错误 警告 问题是 导入时它无法识别该模块 并且
  • 开发者可以在 Windows 应用程序中使用 iCloud 吗?

    开发人员可以使用 Apple 的 iCloud API 在 Mac OS X 和 iOS 上的不同版本的应用程序之间同步应用程序数据 如果开发人员拥有 Windows 版本的应用程序 该版本是否也可以使用 iCloud 将应用程序数据与 M
  • NSUserDefaults 多久同步一次?

    的文档NSUserDefaults说synchronise方法被定期调用 但没有提及频率 10分钟的谷歌搜索没有发现任何信息 发生的频率是多少synchronise方法调用 这是一个未公开的实现细节 可能甚至不是一个恒定的时间间隔 但是 您
  • ReactNative - 未处理的 JS 异常:SyntaxError

    当我尝试在 iOS 8 上启动 RUN 应用程序时 出现这个奇怪的错误 Unhandled JS Exception SyntaxError仅此而已 不再有更多信息 有any1偶然发现这个问题吗 在 iOs 9 上应用程序运行正常 x代码版
  • 在 hooks 文件夹中使用节点脚本时,cordova 插件安装问题

    Cordova 3 4 hooks 未在 iOS 中正确安装提到的插件 我正在添加install plugins js进入文件夹project project root hooks after platform add其中有以下代码 usr
  • SwiftUI:动态“列表”中的“切换”在重用时会破坏其布局?

    我试图展现一种动态List行包含Toggle元素 这Toggle最初布局正确 但是当它们滚动进和滚出视图时 即单元格重用时 它们的布局会中断 最小示例代码 import SwiftUI struct SwitchList View var
  • 更改导航项(栏)的背景颜色

    有没有一种简单的方法可以更改视图顶部导航项的背景颜色 我有一个基于导航的应用程序 我只希望一个视图获得另一种背景颜色 我主要使用 IB 创建视图 我找到了以下解决方案 未测试 float r 10 float g 55 float b 13
  • 如何解决malloc_error_break?

    我在 iOS 3 0 模拟器上遇到此错误 但在 3 1 3 和 3 2 模拟器上没有遇到此错误 创建符号断点后malloc error break 我在日志中看到了这一点 Session started at 2010 02 13 19 1
  • 使用 AVFoundation 裁剪 AVAsset 视频

    我在用AVCaptureMovieFileOutput录制一些视频 我使用显示预览层AVLayerVideoGravityResizeAspectFill稍微放大 我遇到的问题是最终的视频较大 包含预览期间不适合屏幕的额外图像 这是预览和生
  • 对成员“buildBlock()”的引用不明确

    我一直在尝试使用 Swift UI 为 iOS 13 制作一个应用程序 但我不断收到这个奇怪的错误 对成员 buildBlock 的引用不明确 无论我做什么 错误都不会消失 我尝试一次对代码段进行注释 以查看哪一部分可能导致了问题 但唯一有
  • 从 iOS 13 开始安排 iOS 后台任务

    我正在实现用于更新数据的BackgroundTasks 框架 但我遇到了以下问题 无法计划刷新App 错误域 BGTaskSchedulerErrorDomain代码 1 空 无法安排数据提取 Error Domain BGTaskSche
  • 以编程方式从底部裁剪图像

    我正在开发自定义相机应用程序 一切进展顺利 但我在从底部裁剪图像时遇到了问题 即 裁剪后的图像与原始图像具有完全相同的宽度 但高度将为原始图像的 1 3 并且必须从底部开始 斯威夫特3解决方案 func cropBottomImage im
  • NSTimer 不触发选择器

    在带有 ARC 的 ios5 0 中 在我的 rootviewcontroller 中 我调用由应用程序委托持有的安全管理器对象中的方法 在该方法中 我设置计时器如下 NSTimer timer NSTimer scheduledTimer
  • UITableView 滑动删除 iOS 上的手势冲突

    我的手势识别器有问题 我的目标是在表视图中实现使用滑动删除 但我认为其他手势是相互冲突的 我正在使用这个库romonthego REFrostedViewController https github com romaonthego REF
  • 可以获取位置,但无法获取航向

    我目前只使用模拟器 但我在 iOS 模拟器上快速使用 CoreLocation 时遇到问题 我得到此代码打印的位置更新 但从未得到标题 我不想当然 我正在尝试制作一个指南针类型的应用程序 它将显示目标的方位 class CompassVie
  • 在视图之间传递核心数据实体变量

    我无法理解如何在视图之间使用核心数据实体变量 为了更好地理解我的问题是什么 我的代码如下 View A 基本上 您必须将完整预算实体或相关预算实体的 ID 从视图 A 传递到视图 B 由于不知道您的应用程序的视图层次结构和逻辑 我假设您选择
  • AWS S3 公共对象与私有对象?

    回到 S3 我的存储桶中有图像的 URL 我将在我的应用程序中呈现这些图像 但它们被设置为私有 当我尝试单击该链接时 它显示 访问被拒绝 当我将链接的设置更改为公共时 它会通过 但是我读到公共访问并不是最安全的事情 所以这本质上是一个由两部
  • iOS 视图控制器内存在被关闭后未释放

    当用户单击按钮时 它会显示一个带有两个视图控制器的新选项卡栏视图控制器 我是这样做的 ACLevelDownloadController dvc ACLevelDownloadController alloc initWithNibName
  • ios 导航 堆栈操作

    我在尝试从 iOS 应用程序操作导航堆栈时遇到问题 或者至少是由于这种操纵而产生的行为 我的情况 我有 3 个 ViewController 控制器a显示多个级别 控制器 b 是游戏视图 控制器 c 是某种分数 显然 我将在控制器 a 中选

随机推荐

  • 在c中读取/写入bmp文件

    我正在尝试处理 bmp 文件 首先 我尝试从 bmp 文件读取标题和数据并将其写入新文件 pragma pack push 1 Windows 3 x bitmap file header typedef struct char filet
  • golang http2 服务器推送的高级客户端

    golang 1 6 发布 支持 Http2 我在网上搜索 但找不到任何有关如何使用 Go 进行 Http2 服务器推送的示例 是否有为此实现的高级客户端 人们已经做过什么例子了吗 std 库中的 http2 实现不公开 http2 特定的
  • AngularJS 和 i18next

    我见过一些 Angular 的 i18n 插件 但我不想重新发明轮子 i18next 是一个很好的库 所以我打算使用它 我创建了一个指令 i18n 它只调用 i18n 库 define app jquery i18n function ap
  • 按年份划分的R组

    我将 csv 读入 R 现在我有了一个数据列表 head data Date Open High Low Close Volume 1 31 Dec 14 223 09 225 68 222 25 222 41 2402097 2 30 D
  • Android - 使用动画的工件

    应用发现的 3D 转换时 我遇到屏幕上的视觉伪影问题here http developer android com resources samples ApiDemos src com example android apis animat
  • d3.js - 变换和过渡,多行

    我已按照以下说明进行操作 http bost ocks org mike path http bost ocks org mike path 用于用单线创建单图并对其进行动画处理 并且 弄清楚如何在图表中创建多条线 在 D3 js 中绘制多
  • 代码以交互方式运行时显示结果,但从 shell 运行时不显示结果

    我从另一张海报上借用了这个科学记数法小脚本 以科学记数法显示小数 https stackoverflow com questions 6913532 python how to convert decimal to scientific n
  • 音频 API 示例中的“安全错误”代码:“1000”

    我试图重复这个例子here https wiki mozilla org Audio Data API Complete Example 3a Visualizing Audio Spectrum 但收到此错误 Security error
  • C# 中的 DataGridView 组合框单元格事件

    我想在 DataGridViewComboBox 中的项目发生更改时显示一条消息 我可以通过 datagridview CellbeginEdit 事件和 CellEndEdit 事件的帮助来部分执行它 但这还不够 我希望它发生在组合框选择
  • 如何在ios应用程序中播放RTMP视频流?

    嗨 我正在开发广播应用程序 我正在使用 Videocore 库 现在我如何在 ios 应用程序中播放该流视频 我尝试使用 MpMoviePlayer 但它不支持 rtmp 流 那么是否有任何第三方库可供 RTMP 支持的播放器使用 请帮助我
  • 未创建表 sqlite android

    我正在制作一个应用程序 我想在其中保存用户联系人详细信息 但是每当我尝试插入或选择某些值时 我都会收到错误 数据库代码 public class ContactsDatabase extends SQLiteOpenHelper priva
  • 获取Java中注解的参数值

    所以我有一个代码 Path foo public class Hello GET Produces text html public String getHtml Context Request request Context HttpSe
  • 扭曲的Python getPage

    我试图获得这方面的支持 但我完全感到困惑 这是我的代码 from twisted internet import reactor from twisted web client import getPage from twisted web
  • 编辑控件未使用所选画笔完全重新绘制

    我有一个编辑控件 其背景颜色取决于用户输入的有效性 如果输入有效 编辑控件应保持默认外观 否则背景颜色应更改为浅灰色 我正在检查有效性EN UPDATE处理程序 如果它无效 我存储HWND的编辑控件到vector 视觉样式已启用 当我改变鼠
  • 如何修复错误代码 C4146“一元减运算符应用于无符号类型。结果仍然无符号”?

    数据类型int的最小值为 2 147 483 648 所以 我输入了 int val 2147483648 但是 它有一个错误 unary minus operator applied to unsigned type result sti
  • 如何将 ArrayUtils 用于对象数组,它不会删除数组的内容

    如何删除对象数组的内容 如果还有其他方法可以删除对象数组的内容 请分享 import java util Arrays import java util Scanner import org apache commons lang3 Arr
  • IE中Jquery多级列表问题

    首先对我的英语感到抱歉 好吧 我尝试创建一个可排序的问题 答案列表 它在 FF 中完美运行 但在 IE 中不起作用 在 IE 中 当我尝试对答案 第二级 li 进行排序时 其问题和同一组答案以一种奇怪的方式与所选问题一起移动 Example
  • 基于多列值的 Python pandas groupby 值

    我在 Pandas 数据集中有一个连续的活动数据 sample data code user id 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 4705 4705 4705 4705 4705 223 223
  • 具有 DynamoDB 和 MySQL 双数据源的 Spring Data/JPA 存储库

    我熟悉如何让 Spring 通过多个持久单元和多个entityManagerFactoryBean 实现动态处理多个数据源 但我正在努力解决的是如何拥有 MySQL 方言and通过 spring config xml 文件在同一 sprin
  • 来自调试器的 Ios Xcode 消息:由于内存问题而终止

    我有一个带有集合视图的应用程序 以及此集合视图中的一个单元格 该单元格重定向到外部链接 每当该链接打开时 应用程序就会在后台崩溃并在调试器上显示 由于内存问题而终止 如果我只按主页按钮 应用程序就会继续正常工作 if UIDeviceOri