here is the code: http://pastie.org/562956
this code crashes on the call to itemsArray.count on "didSelectRowAtIndexPath". I don't get why... itemsArray is accessed for other methods like "numberOfRowsInSection". why would it all of a sudden get dereferenced ( I assume that is what is happening).
here is the output (dunno what's up with "unable to read unknown load command 0x22" either)
[Session started at 2009-07-28 22:11:50 -0600.]
Warning - No location found for "NSUserDefaults-Optimize.m:81"
GNU gdb 6.3.50-20050815 (Apple version gdb-966) (Tue Mar 10 02:43:13 UTC 2009)
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "i386-apple-darwin".sharedlibrary apply-load-rules all
Attaching to process 56173.
unable to read unknown load command 0x22
unable to read unknown load command 0x22
unable to read unknown load command 0x22
unable to read unknown load command 0x22
unable to read unknown load command 0x22
unable to read unknown load command 0x22
unable to read unknown load command 0x22
unable to read unknown load command 0x22
unable to read unknown load command 0x22
unable to read unknown load command 0x22
unable to read unknown load command 0x22
unable to read unknown load command 0x22
unable to read unknown load command 0x22
unable to read unknown load command 0x22
unable to read unknown load command 0x22
unable to read unknown load command 0x22
unable to read unknown load command 0x22
unable to read unknown load command 0x22
unable to read unknown load command 0x22
2009-07-28 22:11:55.545 Send2iPhone[56173:20b] Load items
2009-07-28 22:11:55.629 Send2iPhone[56173:20b] cellforrow 0
2009-07-28 22:11:55.634 Send2iPhone[56173:20b] value=(null)
2009-07-28 22:11:55.644 Send2iPhone[56173:20b] cellforrow 1
2009-07-28 22:11:55.645 Send2iPhone[56173:20b] value=(null)
2009-07-28 22:11:55.654 Send2iPhone[56173:20b] cellforrow 2
2009-07-28 22:11:55.658 Send2iPhone[56173:20b] value=(null)
2009-07-28 22:11:55.659 Send2iPhone[56173:20b] cellforrow 3
2009-07-28 22:11:55.663 Send2iPhone[56173:20b] value=(null)
2009-07-28 22:11:57.724 Send2iPhone[56173:20b] row = 0
Program received signal: “EXC_BAD_ACCESS”.
kill
quit
The Debugger has exited with status 0.(gdb)
Chuck has it right, you aren't retaining the array.
One fix is to make itemsArray a property of the controller so in the header
#interface RootViewController : UITableViewController {
NSArray *itemsArray;
NSString *test;
}
//add the property directive for itemsArray and tell it to use retain
#property (nonatomic, retain) NSArray *itemsArray;
and in the .m
#implementation RootViewController
// add the synthesize for itemsArray property
#synthesize itemsArray;
// when you set the value of itemsArray use self.itemsArray this will properly retain the array
self.itemsArray = [NSArray arrayWithContentsOfURL:plistURL];
// release the itemsArray in dealloc
- (void)dealloc {
[itemsArray release];
[super dealloc];
}
You are not claiming ownership of itemsArray, so it's being freed by the autorelease pool at some point. You could solve it by setting the variable using an accessor that properly retains and releases. Also, if you haven't, you should read the Cocoa memory management guidelines.
Related
I'm trying to make an little bash script for automatisation of ipa uploading on itunes. [From Xcode uploading it works fine].
For command:
gym
from Fastlane,some projects are uploading fine, others are failing with log:
The following build commands failed:
GenerateDSYMFile [...]
Exit status: 65
In gym logs:
GenerateDSYMFile [...]
dsymutil(20223,0x7fff724c3000) malloc: *** error for object 0x610000100000: pointer being freed was not allocated
*** set a breakpoint in malloc_error_break to debug
Command /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/dsymutil failed with exit code 6
...tried all google solutions....
I've had the same issue.
I've found a reference in this thread, and also here
suggesting that it's the MallocNanoZone environment variable. after changing it (on terminal):
export MallocNanoZone=0
The build successfully completed.
Tested on the iphone 4s device (ver) 5.0.1.
Crashes: When you click on the tab to inter into the index page from main page
1)main.m
//
// main.m
// salah1
// Created by syed ali on 30/11/2011.
// Copyright (c) 2011 j h birmingham. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "AppDelegate.h"
int main(int argc, char *argv[])
{
#autoreleasepool {
return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
}
}
2) LOCAL:
argc int 1
argv char ** 0x2fdffbb4
*argv char * 0x2fdffc68
3) ALL OUTPUT:
GNU gdb 6.3.50-20050815 (Apple version gdb-1708) (Fri Sep 16 06:56:50 UTC 2011)
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "--host=i386-apple-darwin --target=arm-apple-darwin".tty /dev/ttys000
target remote-mobile /tmp/.XcodeGDBRemote-19819-51
Switching to remote-macosx protocol
mem 0x1000 0x3fffffff cache
mem 0x40000000 0xffffffff none
mem 0x00000000 0x0fff none
[Switching to process 7171 thread 0x1c03]
[Switching to process 7171 thread 0x1c03]
sharedlibrary apply-load-rules all
warning: Unable to read symbols for /Users/yakub121/Library/Developer/Xcode/iOS DeviceSupport/5.0.1 (9A405)/Symbols/System/Library/AccessibilityBundles/AccessibilitySettingsLoader.bundle/AccessibilitySettingsLoader (file not found).
warning: No copy of AccessibilitySettingsLoader.bundle/AccessibilitySettingsLoader found locally, reading from memory on remote device. This may slow down the debug session.
[Switching to process 8963 thread 0x2303]
[Switching to process 7171 thread 0x1c03]
warning: Unable to read symbols for /Users/yakub121/Library/Developer/Xcode/iOS DeviceSupport/5.0.1 (9A405)/Symbols/System/Library/AccessibilityBundles/UIKit.axbundle/UIKit (file not found).
warning: No copy of UIKit.axbundle/UIKit found locally, reading from memory on remote device. This may slow down the debug session.
[Switching to process 9219 thread 0x2403]
[Switching to process 7171 thread 0x1c03]
warning: Unable to read symbols for /Users/yakub121/Library/Developer/Xcode/iOS DeviceSupport/5.0.1 (9A405)/Symbols/System/Library/AccessibilityBundles/TelephonyUIFramework.axbundle/TelephonyUIFramework (file not found).
warning: No copy of TelephonyUIFramework.axbundle/TelephonyUIFramework found locally, reading from memory on remote device. This may slow down the debug session.
warning: Unable to read symbols for /Users/yakub121/Library/Developer/Xcode/iOS DeviceSupport/5.0.1 (9A405)/Symbols/System/Library/AccessibilityBundles/TextInput.axbundle/TextInput (file not found).
warning: No copy of TextInput.axbundle/TextInput found locally, reading from memory on remote device. This may slow down the debug session.
warning: Unable to read symbols for /Users/yakub121/Library/Developer/Xcode/iOS DeviceSupport/5.0.1 (9A405)/Symbols/System/Library/AccessibilityBundles/MediaPlayerFramework.axbundle/MediaPlayerFramework (file not found).
warning: No copy of MediaPlayerFramework.axbundle/MediaPlayerFramework found locally, reading from memory on remote device. This may slow down the debug session.
warning: Unable to read symbols for /Users/yakub121/Library/Developer/Xcode/iOS DeviceSupport/5.0.1 (9A405)/Symbols/System/Library/AccessibilityBundles/iTunesStoreFramework.axbundle/iTunesStoreFramework (file not found).
warning: No copy of iTunesStoreFramework.axbundle/iTunesStoreFramework found locally, reading from memory on remote device. This may slow down the debug session.
warning: Unable to read symbols for /Users/yakub121/Library/Developer/Xcode/iOS DeviceSupport/5.0.1 (9A405)/Symbols/System/Library/AccessibilityBundles/AXExtraExtras.axbundle/AXExtraExtras (file not found).
warning: No copy of AXExtraExtras.axbundle/AXExtraExtras found locally, reading from memory on remote device. This may slow down the debug session.
warning: Unable to read symbols for /Users/yakub121/Library/Developer/Xcode/iOS DeviceSupport/5.0.1 (9A405)/Symbols/System/Library/AccessibilityBundles/QuickSpeak.bundle/QuickSpeak (file not found).
warning: No copy of QuickSpeak.bundle/QuickSpeak found locally, reading from memory on remote device. This may slow down the debug session.
[Switching to process 9731 thread 0x2603]
warning: Unable to read symbols for /Users/yakub121/Library/Developer/Xcode/iOS DeviceSupport/5.0.1 (9A405)/Symbols/System/Library/AccessibilityBundles/PreferencesFramework.axbundle/PreferencesFramework (file not found).
warning: No copy of PreferencesFramework.axbundle/PreferencesFramework found locally, reading from memory on remote device. This may slow down the debug session.
2011-12-08 11:14:48.095 salah1[3198:707] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Could not load NIB in bundle: 'NSBundle </var/mobile/Applications/F9548CB5-9248-4C10-AEE7-B843DE8E1D36/salah1.app> (loaded)' with name 'Custom_Cell''
*** First throw call stack:
(0x3802e8bf 0x31b141e5 0x3802e7b9 0x3802e7db 0x3565a747 0x3565bbb9 0x2a03 0x354469cb 0x35445aa9 0x35445233 0x353e9d4b 0x37f8d22b 0x33784381 0x33783f99 0x3378811b 0x33787e57 0x3377fd85 0x38002b4b 0x38000d87 0x380010e1 0x37f844dd 0x37f843a5 0x37b02fcd 0x35414743 0x21cd 0x2164)
terminate called throwing an exception[Switching to process 7171 thread 0x1c03]
(gdb)
Your problem is that one of the nibs names is not correctly named:
Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Could not load NIB in bundle: 'NSBundle (loaded)' with name 'Custom_Cell'
The simulator is not case sensitive but the iPhone is. So Custom_Cell != custom_cell
The error is right in the GDB stack that you provided:
'Could not load NIB in bundle: 'NSBundle </var/mobile/Applications/F9548CB5-9248-4C10-AEE7-B843DE8E1D36/salah1.app> (loaded)' with name 'Custom_Cell''
Do you have a NIB with the name Custom_Cell? Can you show us the code that is executing when the crash occurs? Can you show us how your Custom_Cell is defined in Interface Builder?
I am testing an EXE_BAD_ACCESS error. I have set NSZombieEnabled, MallocStackLogging, MallocStackLoggingNoCompact to YES. now in the debugger I get this message when I run my app in the debug mode from the device I could see this:
iota(3586) malloc: recording malloc stacks to disk using standard recorder
iota(3586) malloc: stack logs being written into /private/var/mobile/Applications/8E21A85B-369E-4487-962B-1550E56602DC/tmp/stack-logs.3586.iota.index
iota(3586) malloc: Please issue: cp /private/var/mobile/Applications/8E21A85B-369E-4487-962B-1550E56602DC/tmp/stack-logs.3586.iota.suRQjy.link /tmp/
and when I am about to hit the error I get,
2011-02-14 14:29:44.350 iota[3586:307] *** -[CFString autorelease]: message sent to deallocated instance 0x81eab70
Finally when I give the command in debugger to see the stack trace
(gdb) shell malloc_history 3586 0x81eab70
I get
malloc_history cannot examine process 3586 because the process does not exist.
Can anyone tell me what I am doing wrong, before the error is about the occur , I set
set env MallocStackLogging 1 in the debugger too
Thanks in Advance
You might not be able to look at the malloc_history because you're running this on the device. I had the same error and Instruments was also freezing or not starting my application.
But - if I ran in the iOS simulator and then configured the allocations tool to handle zombies (this option wasn't available on the device) then I can see pretty quickly the object which was prematurely released.
From what I understand you are releasing manually a string that is already on the autorelease Pool.
All strings created with
[NSString stringWithFormat:#"some %#", #"text"];
And
[NSString stringWithString:#"some text"];
must not be manually released.
Trying to fix a bug on iOS 4 but when I debug it crashes with these errors:
SDK is installed in seperate directory as I need to deug 3.1.3 as well
Developer_Xcode3_2_3_iOS_SDK_4_0_1
Device is running 4.0.1
Any ideas? Cheers
[Session started at 2010-07-27 14:26:45 +0100.]
Undefined command: "Developer". Try "help".
Undefined command: "Developer". Try "help".
Undefined command: "Developer". Try "help".
Undefined command: "Developer". Try "help".
GNU gdb 6.3.50-20050815 (Apple version gdb-1470) (Thu May 27 05:54:06 UTC 2010)
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "--host=i386-apple-darwin --target=arm-apple-darwin".Developer_Xcode3_2_3_iOS_SDK_4_0_1/Platforms/iPhoneOS.platform/DeviceSupport/4.0.1/Symbols/usr" /System "/Developer_Xcode3_2_3_iOS_SDK_4_0_1
Developer_Xcode3_2_3_iOS_SDK_4_0_1/Platforms/iPhoneOS.platform/DeviceSupport/4.0.1/Symbols/System" /private/var/mobile/Applications/50A5673A-2D68-4EA2-B033-2CA40C8DFC79 /Users/clearbrian/Documents/Development/IPhoneDevelopment/029.LondonBusMaps/021.Bus.v2a.RedesignWithRoutes_iOs4Recompile/Bus/build/Debug-iphoneos /var/mobile/Applications/50A5673A-2D68-4EA2-B033-2CA40C8DFC79 /Users/clearbrian/Documents/Development/IPhoneDevelopment/029.LondonBusMaps/021.Bus.v2a.RedesignWithRoutes_iOs4Recompile/Bus/build/Debug-iphoneos /Developer "/Developer_Xcode3_2_3_iOS_SDK_4_0_1
Loading program into debugger…
Undefined command: "Developer". Try "help".
Undefined command: "Developer". Try "help".
Developer_Xcode3_2_3_iOS_SDK_4_0_1/Platforms/iPhoneOS.platform/DeviceSupport/4.0.1/Symbols/Developer"
Undefined command: "Developer". Try "help".
Undefined command: "Developer". Try "help".
Developer_Xcode3_2_3_iOS_SDK_4_0_1/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin
Developer_Xcode3_2_3_iOS_SDK_4_0_1/Library/PrivateFrameworks/DevToolsInterface.framework/Resources/Xcode SSHPassKey
tty /dev/ttys001
warning: Unable to read symbols from "dyld" (prefix __dyld_) (not yet mapped into memory).
warning: Unable to read symbols from "libxml2.2.dylib" (not yet mapped into memory).
warning: Unable to read symbols from "Foundation" (not yet mapped into memory).
warning: Unable to read symbols for "/System/Library/Frameworks/UIKit.framework/UIKit" (file not found).
warning: Unable to read symbols from "UIKit" (not yet mapped into memory).
warning: Unable to read symbols for "/System/Library/Frameworks/CoreGraphics.framework/CoreGraphics" (file not found).
warning: Unable to read symbols from "CoreGraphics" (not yet mapped into memory).
warning: Unable to read symbols for "/System/Library/Frameworks/CFNetwork.framework/CFNetwork" (file not found).
warning: Unable to read symbols from "CFNetwork" (not yet mapped into memory).
warning: Unable to read symbols from "CoreLocation" (not yet mapped into memory).
warning: Unable to read symbols for "/System/Library/Frameworks/MapKit.framework/MapKit" (file not found).
warning: Unable to read symbols from "MapKit" (not yet mapped into memory).
warning: Unable to read symbols for "/System/Library/Frameworks/MessageUI.framework/MessageUI" (file not found).
warning: Unable to read symbols from "MessageUI" (not yet mapped into memory).
warning: Unable to read symbols for "/System/Library/Frameworks/MobileCoreServices.framework/MobileCoreServices" (file not found).
warning: Unable to read symbols from "MobileCoreServices" (not yet mapped into memory).
warning: Unable to read symbols from "QuartzCore" (not yet mapped into memory).
warning: Unable to read symbols from "SystemConfiguration" (not yet mapped into memory).
warning: Unable to read symbols from "libsqlite3.dylib" (not yet mapped into memory).
warning: Unable to read symbols from "libz.1.dylib" (not yet mapped into memory).
warning: Unable to read symbols from "libgcc_s.1.dylib" (not yet mapped into memory).
warning: Unable to read symbols from "libSystem.B.dylib" (not yet mapped into memory).
warning: Unable to read symbols from "libobjc.A.dylib" (not yet mapped into memory).
warning: Unable to read symbols from "CoreFoundation" (not yet mapped into memory).
Program loaded.
target remote-mobile /tmp/.XcodeGDBRemote-407-23
Switching to remote-macosx protocol
mem 0x1000 0x3fffffff cache
mem 0x40000000 0xffffffff none
mem 0x00000000 0x0fff none
(gdb) run
Running…
[Switching to thread 11523]
[Switching to thread 11523]
gdb stack crawl at point of internal error:
0 gdb-arm-apple-darwin 0x0013117d internal_vproblem + 316
1 gdb-arm-apple-darwin 0x001313c1 internal_verror + 43
2 gdb-arm-apple-darwin 0x001313f6 align_down + 0
3 gdb-arm-apple-darwin 0x001825b1 macosx_solib_add + 959
4 gdb-arm-apple-darwin 0x00196394 remote_macosx_complete_create_or_attach + 225
5 gdb-arm-apple-darwin 0x00196a0c remote_macosx_create_inferior + 1083
6 gdb-arm-apple-darwin 0x0006f9ad run_command_1 + 660
7 gdb-arm-apple-darwin 0x0012f132 execute_command + 713
8 gdb-arm-apple-darwin 0x0001bf67 mi_execute_async_cli_command + 226
9 gdb-arm-apple-darwin 0x0001b584 captured_mi_execute_command + 371
10 gdb-arm-apple-darwin 0x0008546f catch_exception + 65
11 gdb-arm-apple-darwin 0x000188e2 mi_execute_command + 163
12 gdb-arm-apple-darwin 0x00018a87 mi_execute_command_wrapper + 50
13 gdb-arm-apple-darwin 0x0008ae51 handle_file_event + 349
14 gdb-arm-apple-darwin 0x0008a818 process_event + 131
/SourceCache/gdb/gdb-1470/src/gdb/macosx/macosx-nat-dyld.c:1547: internal-error: unrecognized shared library breakpoint
A problem internal to GDB has been detected,
further debugging may prove unreliable.
The Debugger has exited with status 1.The Debugger has exited with status 1.
Someone asked had I created symlinks
A few months ago when 3.0.1 came out I had problems getting it to work with XCode and found this help:
Topic : iPhone OS 3.0.1 does not work with xCode
http://discussions.apple.com/thread.jspa?threadID=2103502&tstart=0
So I ran this and it seemed to work.
ln -s /Developer/Platforms/iPhoneOS.platform/DeviceSupport/3.0\ \(7A341\) /Developer/Platforms/iPhoneOS.platform/DeviceSupport/3.0.1
The symbolic link no longer works so just wondering should I delete it.
Some notes on my installation layout
I have these installation directories:
Developer: 3.1.3 - works - app in AppStore
Developer3_2_Final:
Developer_4_0_Final_Xcode3_2_3:
Developer_Xcode3_2_3_iOS_SDK_4_0_1: This is the version that crashes
The only symbolic link I created was under /Developer
yet crash caused when I use Xcode in /Developer_Xcode3_2_3_iOS_SDK_4_0_1
My app was built in 3.1.3 using /Developer so am loath to remove it.
not a unix guru though am willing to dive in so any pointers gratefully received.
The /Developer_Xcode3_2_3_iOS_SDK_4_0_1 was installed yesterday and I ran the 3.1.3 against it and then debugger when running on device crashed.
So I have done nothing with any of these SDKs except create that symlink months ago and install SDKs above 3.1.3 in seperate directories till I was sure I could build against them.
I have a UISegmentedControl and whenever I touch a button it should show an alert with the index of the segment currently selected:
- (IBAction)bOkayTouched:(id)sender
{
NSString *msg = [NSString stringWithFormat:#"%#", [scRPSSL selectedSegmentIndex]];
UIAlertView *lol = [[UIAlertView alloc] initWithTitle:#"Mkay" message:msg delegate:self cancelButtonTitle:#"Okay" otherButtonTitles:nil];
[lol show];
[lol release];
}
However, the app crashes when it must create the NSString. But it does not crash when I replace that line with:
NSString *msg = [NSString stringWithFormat:#"XD"];
or similar.
Oh, and here's what the debugger tells me:
[Session started at 2009-08-30 21:04:38 +0200.]
[Session started at 2009-08-30 21:04:43 +0200.]
GNU gdb 6.3.50-20050815 (Apple version gdb-966) (Tue Mar 10 02:43:13 UTC 2009)
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "i386-apple-darwin".sharedlibrary apply-load-rules all
Attaching to process 4630.
unable to read unknown load command 0x80000022
unable to read unknown load command 0x80000022
unable to read unknown load command 0x80000022
unable to read unknown load command 0x80000022
unable to read unknown load command 0x80000022
unable to read unknown load command 0x80000022
unable to read unknown load command 0x80000022
unable to read unknown load command 0x80000022
unable to read unknown load command 0x80000022
unable to read unknown load command 0x80000022
unable to read unknown load command 0x80000022
unable to read unknown load command 0x80000022
unable to read unknown load command 0x80000022
unable to read unknown load command 0x80000022
unable to read unknown load command 0x80000022
unable to read unknown load command 0x80000022
unable to read unknown load command 0x80000022
unable to read unknown load command 0x80000022
unable to read unknown load command 0x80000022
unable to read unknown load command 0x80000022
unable to read unknown load command 0x80000022
unable to read unknown load command 0x80000022
unable to read unknown load command 0x80000022
unable to read unknown load command 0x80000022
unable to read unknown load command 0x80000022
unable to read unknown load command 0x80000022
unable to read unknown load command 0x80000022
unable to read unknown load command 0x80000022
unable to read unknown load command 0x80000022
unable to read unknown load command 0x80000022
unable to read unknown load command 0x80000022
unable to read unknown load command 0x80000022
unable to read unknown load command 0x80000022
unable to read unknown load command 0x80000022
unable to read unknown load command 0x80000022
unable to read unknown load command 0x80000022
unable to read unknown load command 0x80000022
unable to read unknown load command 0x80000022
unable to read unknown load command 0x80000022
unable to read unknown load command 0x80000022
(gdb)
Can anyone help me?
Also, the alert says '(null)' if the selected index is 0 (zero).
Thanks!
selectedSegmentIndex is likely an integer value, in which case the format string %# is not the right choice. Try the following instead:
[NSString stringWithFormat:#"%d", [scRPSSL selectedSegmentIndex]];
More information can be found in Apple's developer documentation on format specifiers, but the gist of it is that %# is used only for subclasses of NSObject. It works by calling [object description] which returns a string. If you use it on an integer value, you are essentially sending an Objective-C message to something that isn't an object, which results in undefined behaviour (usually a crash).