デバッグEXC_BAD_ACCESSからNSString
-
23-09-2019 - |
質問
あったかEXC_BAD_ACCESSメッセージ私のソフトである。ある時なんか、僕たちのために環境変数NSZombieEnabledとMallocStackLoggingNoCompactに このサイト.作成した環境変数 NSZombieEnabled=YES や MallocStackLoggingNoCompact=1.コンソールでの見
2010-03-01 19:13:46.924 CruzNomad[7952:207] *** -[CFString stringByAddingPercentEscapesUsingencoding:]:メッセージを送割インスタンス 0x58448e0
その後(gdb)に対して迅速かったので 情報malloc-歴史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という問題にしたものであった85BuisnessCardViewController.mとなります。このラインはこちら:
fullAddress = [NSString stringWithFormat:@"%@ %@", fullAddress, myString];
私は追加の内容 fullAddress や myString および保管い fullAddress.
ばんこの解釈が正しく、その後、この線 fullAddress が割.私がドロップブレークポイントやマウスをのせると変数の値は"対象外です。"
fullAddress 作品はその後、この方法です。いで送信Google逆ジオコーディングに沿164同じ方法です。
NSString *urlString = [NSString stringWithFormat:@"http://maps.google.com/maps/geo?q=%@&output=csv", [fullAddress stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]];
でも、ここでは"対象外です。" 私stumped...アドバイス??
よろしく!
トーマス
解決
あなたがオブジェクトの属性を保持し、後半に、他の方法でそれに遅れてメッセージを送信しないときほとんどの場合、この問題が発生します。
文字列の一部が初期化されます。そうは、試します:
[fullAddress retain];
または
[myString retain];
一つは他の方法で初期化される応じます。
他のヒント
してください添付文字列のフォーマットは何ですか?
fullAddress = [NSString stringWithFormat:@"%@ %@", fullAddress, myString];
:
- (NSString *)stringByAppendingFormat:(NSString *)format ...
このように:
[fullAddress stringByAppendingFormat:@" %@", myString];