- c - 在位数组中找到第一个零
- linux - Unix 显示有关匹配两种模式之一的文件的信息
- 正则表达式替换多个文件
- linux - 隐藏来自 xtrace 的命令
我的控制台中有一条 EXC_BAD_ACCESS 消息。我在 this site 上阅读了有关环境变量 NSZombieEnabled 和 MallocStackLoggingNoCompact 的信息.我创建了我的环境变量:NSZombieEnabled = YES 和 MallocStackLoggingNoCompact = 1。在控制台中,我看到了
2010-03-01 19:13:46.924 CruzNomad[7952:207] *** -[CFString stringByAddingPercentEscapesUsingEncoding:]: message sent to deallocated instance 0x58448e0
然后在 (gdb) 提示符下,我执行了 info malloc-history 0x58448e0,这给了我:
Alloc: Block address: 0x058448e0 length: 64
Stack - pthread: 0xa0b33500 number of frames: 25
0: 0x98e089bc in malloc_zone_malloc
1: 0x21516aa in _CFRuntimeCreateInstance
2: 0x2152bf8 in __CFStringCreateImmutableFunnel3
3: 0x21567d9 in CFStringCreateCopy
4: 0x21742fc in _CFStringCreateWithFormatAndArgumentsAux
5: 0xdb546 in -[NSPlaceholderString initWithFormat:locale:arguments:]
6: 0xdb4d8 in +[NSString stringWithFormat:]
7: 0x23aa3 in -[BuisnessCardViewController viewDidLoad] at /Users/.../Classes/BuisnessCardViewController.m:85
8: 0x3d6796 in -[UIViewController view]
9: 0x347b4 in -[gm_menuViewController btn5_Pressed:] at /Users/.../Classes/menuViewController.m:535
10: 0x357459 in -[UIApplication sendAction:to:from:forEvent:]
11: 0x3baba2 in -[UIControl sendAction:to:forEvent:]
12: 0x3bcdc3 in -[UIControl(Internal) _sendActionsForEvents:withEvent:]
13: 0x3bbb0f in -[UIControl touchesEnded:withEvent:]
14: 0x370e33 in -[UIWindow _sendTouchesForEvent:]
15: 0x35a81c in -[UIApplication sendEvent:]
16: 0x3610b5 in _UIApplicationHandleEvent
17: 0x2984ed1 in PurpleEventCallback
18: 0x2197b80 in CFRunLoopRunSpecific
19: 0x2196c48 in CFRunLoopRunInMode
20: 0x298378d in GSEventRunModal
21: 0x2983852 in GSEventRun
22: 0x362003 in UIApplicationMain
23: 0x2c8c in main at /Users/.../source/main.m:14
24: 0x2bfa in start
第 7 行说问题出在 BuisnessCardViewController.m 的第 85 行。该行在这里:
fullAddress = [NSString stringWithFormat:@"%@ %@", fullAddress, myString];
我附加了 fullAddress 和 myString 的内容并将其存储回 fullAddress。
如果我对此的解释正确,似乎在这一行之后,fullAddress 被释放。当我放下断点并将鼠标悬停在变量上时,它的值显示“超出范围”。
fullAddress 稍后在此方法中起作用。我在第 164 行使用相同的方法发送到 Google 进行反向地理编码。
NSString *urlString = [NSString stringWithFormat:@"http://maps.google.com/maps/geo?q=%@&output=csv", [fullAddress stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]];
即使在这里,它也表示“超出范围”。我很难过……有什么建议吗??
谢谢!
托马斯
最佳答案
在大多数情况下,当您不保留对象属性并在其他方法中向其发送延迟消息时,就会发生这种情况。
所以,在初始化一些字符串的地方尝试:
[fullAddress retain];
或
[myString retain];
取决于哪个在其他方法中初始化。
关于objective-c - 从 NSString 调试 EXC_BAD_ACCESS,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2360273/
我遇到了一些应用程序崩溃的问题,我需要一些指导才能修复它。我有一个带有主视图和模态视图的应用程序,非常类似于默认的翻转实用模板。当我第一次运行该应用程序时,一切都运行良好,包括模态视图。但是,当我返回
UPDATE: I updated the correction of my definition of Realm, I still get the error. I'm using Swi
我正在尝试用带有c的sqlite3创建一个CGI可执行文件。但我收到错误exc_badd_access,我不知道问题出在哪里。我的代码是:。main.c。sqlite.h。Sqlite.c。Confi
我正在尝试用带有c的sqlite3创建一个CGI可执行文件。但我收到错误exc_badd_access,我不知道问题出在哪里。我的代码是:。Main.c。sqlite.h。Sqlite.c。Confi
我正在尝试暂停 AVAudioPlayer如果当前正在播放。当我调试我的代码并检查时 AVAudioPlayer ,我看是分配的。当我尝试访问它的方法/属性(即 myAudioPlayer isPla
我正在使用 xcode 用 C 语言编写这个简单的程序。 #include int main() { double A[200][200][2][1][2][2]; int B[2
这是我得到的错误 Thread 1:EXC_BAD_ACCESS (code=2, address=0xb7ffffc) 在这条线上 [[NSNotificationCenter defaultCen
我的 iPhone 应用程序出现问题,出现 EXC_BAD_ACCESS,出现一些内存泄漏,但这些问题现已修复,所以我不确定发生了什么。我意识到我没有提供很多信息,但我真的不知道发生了什么。 打开初始
//adds a button to scroll list -(void) addNode:(NSString *) atitle{ UIButton *btn = [UIButton
我几乎完成了我的第一个应用程序,但我遇到了一个奇怪的 EXC_BAD_ACCESS,这种情况几乎一直在发生。 这是跟踪: #0 0x02adba93 in objc_msgSend #1 0x0702
我一直在研究核心数据,并开始编写一些方法来查询不同日期范围的数据。我的核心数据模型非常简单(名为 Smoke 的实体,具有一个字段 - 时间戳(日期类型)。 当我执行代码时,会返回正确的计数,但出现自
我有以下代码: ABAddressBookRef ab; ab = ABAddressBookCreate(); int len = (int) ABAddressBookGetPersonCount
希望有人可以帮助我调试这个问题,因为 EXC_BAD_ACCESS 是我收到的唯一错误。我也尝试过打开 NSZombieEnabled,但据我所知,没有获得更多信息。 问题。我有四个实体: A ->
我正在 tableView 上加载自定义单元格,并在 tableView 中返回 50 行。一些行数显示在表格 View 中,但是当滚动表格 View 时,我的自定义单元格不显示,并且出现错误 "EX
我正在尝试使用 NSLog 来打印控制台消息。问题是有时我在调用它时收到“EXC_BAD_ACCESS”错误 -(void)willRotateToInterfaceOrientation:(UIIn
这是我使用音频队列生成噪音的代码: http://pastebin.com/Kn8GU72J 问题是我的代码生成了 EXC_BAD_ACCESS。问题似乎出在作业中 MAAudioManage
我正在开发适用于 iOS 的 OpenGL ES 2 应用程序。今天早上(没有更改任何代码)我开始从 sgxTextureGetImageRowBytes 抛出 EXC_BAD_ACCESS。 #0
我在这里完全迷路了。 我的应用程序中有Google Analytics(分析),可查看有多少用户从UITableView进入detailview 我在viewDidLoad方法中添加了Google A
我是 Cocoa 新手,正在编写一个简单的应用程序来学习使用 Core Data,但它因 EXC_BAD_ACCESS 而崩溃。尝试了几种方法,但尚未找到解决方案。正如我所说,我对 Cocoa 的经验
以下代码使应用程序崩溃,我不知道为什么。它不规则地崩溃,这意味着有时单击一行时 ImageView 可以显示 30 次,有时当我选择一行时它会第二次崩溃。 仅供引用:事件指示器、操作表和变量 imag
我是一名优秀的程序员,十分优秀!