来自调试器的 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 消息:由于内存问题而终止 的相关文章

  • 使用 NSString 进行 UTF8 解码

    我是 Objective C 新手 尝试使用以下示例将格式错误的 UTF8 编码 NSString 转换为格式良好的字符串苹果文档 http developer apple com library mac documentation Coc
  • 如何在iOS中处理1到3个手指的滑动手势

    我使用以下代码来处理代码中的 1 根手指滑动 UISwipeGestureRecognizer swipe UISwipeGestureRecognizer alloc initWithTarget self action selector
  • 如何保护 iOS 应用程序免受任何操作系统攻击(在越狱设备上)

    我希望保护我的应用程序数据 以防任何操作系统攻击或越狱 iOS 设备上的未经授权的访问 在这种情况下 有什么方法可以检测此类威胁并保护应用程序数据 虽然我同意 jrturton 的说法 但如果您有想要保护的关键数据免受流氓应用程序 而不是用
  • 错误域=kAFAssistantErrorDomain 代码=209“(空)”

    我面临着一个问题SFSpeechRecognizer 启动应用程序几秒钟后 我开始收到错误消息 错误域 kAFAssistantErrorDomain 代码 209 空 和 错误 域 kAFAssistantErrorDomain 代码 2
  • 有关 Swift 编译器选项的文档

    您好 我想开始在 Apple Swift 语言上运行一些微基准测试 然而 我觉得很难找到有关编译器优化的不同选项的适当文档 我读过很多关于其他人的语言微基准的问题和文章 但是如果能有一些关于该主题的可靠文档那就太好了 在最新的测试版中 使用
  • (Kiss)XML xpath 和默认命名空间

    我正在开发一个 iPhone 项目 需要解析一些 xml xml 可能包含也可能不包含默认名称空间 我需要知道如何解析 xml 以防它使用默认命名空间 由于我需要读取和写入 xml 因此我倾向于使用 KissXML 但我愿意接受建议 这是我
  • ios swift parse:从 3 个类收集数据

    我有这样的结构 User CardSet 带有指向 User objectId 的指针 user 和 col name 带有点 cards 的卡片到 Card Set objectId 和列 name 我想选择所有卡数据 包括当前用户的卡集
  • 使用未解析的标识符“FlurryAdInterstitial”

    我正在尝试整合Flurry Interstitial Ads使用cocoapods in Swift and Xcode 7 1 1 我正在关注开发人员雅虎网站上的此文档 https developer yahoo com flurry d
  • 从命令行添加 Xcode 开发者帐户

    我正在尝试使用xcodebuild allowProvisioningUpdates在我只能通过命令行访问的计算机 Azure Devops macOS 托管计算机 上 不幸的是 根据man xcodebuild为了使用 allowProv
  • 用户验证 Facebook 后未调用应用程序打开 Url 方法

    我已将 ios 应用程序中的 facebook 升级到 3 0 并使用提供的代码https developers facebook com docs howtos login with facebook using ios sdk http
  • 构建错误重复符号 arclite.o

    我正在尝试构建我的 Xcode 项目 但收到下面显示的错误 请帮我解决这个错误 提前谢谢您 duplicate symbol non lazy classes in Applications Xcode app Contents Devel
  • 贴纸包会在模拟器上使 iMessage 崩溃,但在 iPhone 上不会崩溃

    按照 Apple 的在线说明和视频在 Xcode 中创建了一个贴纸包 所有图像的尺寸均正确且远低于文件大小阈值 如果我在我的实体 iPhone 上构建并运行贴纸包 一切都会完美运行 如果我在模拟器上构建并运行贴纸包 对于任何模拟的 iPho
  • 访问目标 c 中的类方法。使用 self 还是类名?

    我正在学习 iOS 编程 并且对以下有关关键字 self 的使用的代码感到困惑 据我了解 self就像Java的this 它指的是当前实例 当我想调用类方法时 通常的方式应该是这样 PlayingCard validSuits 但是侵入实例
  • 如何在代码中编辑约束

    我有一个以 100 开始宽度限制的网页 当用户单击按钮时 我想将约束更改为 200 我试过这个 NSLayoutConstraint constrain NSLayoutConstraint constraintWithItem self
  • 在 UIWebView 中播放 Facebook 视频

    有谁知道如何在 Facebook 上播放视频UIWebView 我的应用程序将视频上 传到 Facebook 并检索视频的网址 我想将此网址嵌入到UIWebView播放 我已经为 youtube 解决了这个问题 但没有为 Facebook
  • 如何解决 Xcode 5 中的红色(已移动)文件?

    在 Xcode 4 中 当您要移动文件时 可以通过单击右侧菜单中的按钮并通过 Finder 选择新位置来解析文件的新位置 在 Xcode 5 中 右侧菜单中没有按钮 我还没有找到任何方法通过右键单击文件或顶部菜单栏选项来指定文件的新位置 在
  • iOS:如何知道 reloadData() 已完成其任务?

    我想滚动到给定索引 self boldRowPath 但是当我调试时scrollToRow之前执行reloadData 如何知道reloadData已完成 func getAllTimeEvent self arrAllTimeEvent
  • 在 Swift 中从 Parse 加载图像

    我成功地将数据从 Parse 提取到 swift 中 但我的图像似乎没有按照我的方式工作 在我的 cellForRowAtIndexPath 方法中 我执行以下操作 var event AnyObject eventContainerArr
  • CoreBluetooth:检测设备超出范围/连接超时

    我正在设计一个 iOS 框架来处理多个 BLE 设备 均为同一类型 目前一切都运行良好 除了一件事 客户想要一个包含可用设备的列表 但是 我如何检测过去发现的设备何时不再可用 当我尝试连接到不再可用的设备时 会出现另一个问题 文档说 连接尝
  • 更改 iOS7 中 UIAlertView 的字体大小

    我想更改alertView中消息文本和标题文本的字体大小 苹果网站上没有任何文档谈到这一点 但苹果在其子类注释中表示 UIAlertView 类旨在按原样使用 请参考以下链接 https developer apple com librar

随机推荐

  • 在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