- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
嗨,我有以下代码
NSString *analyticsStr = [[NSString alloc] initWithString:[self constructXMLMessage:TagObj]];
NSInvocationOperation *operation = [[NSInvocationOperation alloc] initWithTarget:self
selector:@selector(sendAnalyticsString:)
object:analyticsStr];
[operationQueue addOperation:operation];
[analyticsStr release];
//[operation release];
当我取消注释 [操作发布] 时,我的应用程序崩溃了。我收到此错误:
malloc: * error for object 0x726ed50: pointer being freed was not allocated * set a breakpoint in malloc_error_break to debug
我认为 NSOperationQueue 负责保留对象。我是否做错了什么或没有意识到什么。
最佳答案
使用 Instruments 的 Zombies 模板来调试它。当您在应该释放对象后向对象发送消息时,时间线中会出现一个标志;您可以单击该标志中的按钮开始调查不当释放该对象的原因。
顺便说一句,您不需要创建该字符串对象。 constructXMLMessage:
返回的字符串将持续与当前自动释放池一样长的时间,这应该是您需要使用它的所有时间。它不会突然死在你身上。
关于objective-c - 释放 NSInitationOperation 会导致应用程序崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4744691/
我正在尝试从网址加载后台图像。如果我传递的只是 NSUrl,则代码效果很好。如果我尝试传递带有附加变量的 NSArray,它永远不会被调用: 这段代码效果很好,调用了 LoadImage2,而 Loa
我已经设置了一个操作队列和一个调用操作。我需要发出调用已完成的信号吗?如果不是,操作队列如何知道调用已完成并继续下一个调用?操作队列已设置为一次执行一个操作。 最佳答案 不,无需发出调用已完成的信号。
嗨,我有以下代码 NSString *analyticsStr = [[NSString alloc] initWithString:[self constructXMLMessage:TagObj]
以下两个问题都是在上下文中提出的,以维护 NSOperationQueue 和 NSInitationOperation。 由于我已经使用这个概念来下载多个视频,因此在下载视频完成后,如何从 NSOp
我想识别每个 NSInitationOperation,以识别 KVO 通知中 isFinished 中的此操作。 因此,我计划不在我的 VC 中将 NSInitationOperation 维护为
我有一个很长的操作 O,它是通过 NSInitationOperation 调用的,它本身是通过将其添加到 NSOperationQueue 中来调度的,以便它异步运行。在我的应用程序中,在两种不同的
我是一名优秀的程序员,十分优秀!