small medium large xlarge

Nutrition-potato_pragsmall
14 Nov 2009, 16:51
Chris Jennings (3 posts)

I’m truly enjoying your book, and learning objective-c. Thanks.

I get a different result in section 6.7 “Using Zombies”, though. Instead of…

     Greeter greetee: Maggie created: 2009-09-18 14:24:43 -0400     
     objc[11179]: FREED(id): message respondsToSelector: sent to freed object=0x3b06760
     REFERENCE COUNTING	101
     Program received signal: ‘‘EXC_BAD_INSTRUCTION''.

I get…

     2009-11-12 23:03:39.536 Flashlight[611:207] Greeter name: Maggie
      created: 2009-11-12 23:03:39 -0800
     2009-11-12 23:03:39.536 Flashlight[611:207] Greeter Greeter 
     (gdb) 

</code>

But after enabling zombies I get what’s described in your book…

     2009-11-12 23:18:14.574 Flashlight[661:207] Greeter name: Maggie
      created: 2009-11-12 23:18:14 -0800
     2009-11-12 23:18:14.575 Flashlight[661:207] *** -[Greeter release]: message sent to     
     deallocated instance 0x380da90

</code>

I’m using Snow Leopard and XCode 3.2.1. My book copy is B1.11 printing, October 23, 2009.

,chris

Nutrition-potato_pragsmall
14 Nov 2009, 16:57
Chris Jennings (3 posts)

May be user error….

Two days later, I can’t reproduce my own original results. All I can say is the “Greeter Greeter” result did happen repeatedly before I set NSZombieEnabled=YES… two days ago. :-\

,chris

Daniel_pragsmall
19 Dec 2009, 03:54
Daniel H Steinberg (98 posts)

Chris if you can replicate it please let me know.

Photo_on_2010-01-27_at_20.59__2_pragsmall
20 Aug 2010, 02:56
John Eigenbrode (1 post)

I’m using Xcode 3.2.3 and using Zombies results in the following in the Cosole:

2010-08-19 22:11:56.017 Flashlight[34701:207] Greeter name: Maggie created: 2010-08-19 22:11:56 -0400, (gdb)

However it opens two more windows and when you highlight the bold line “8 -[FlashlightAppDelegate applicaiton:didFinishLaunchingWithOptions:] in one window the other window changes from a listing of the executable machine code to FlashlightAppDelegate.m and highlights the line containing the sending the message to the release object.

So Xcode now does all the work.

Generic-user-small
09 Feb 2011, 00:52
Barry Jones (2 posts)

I had something similar after releasing host and repeating the log output :

2011-02-08 16:39:48.315 Flashlight[36345:40b] Greeter name: Maggie 

 created: 2011-02-09 00:39:48 +0000

2011-02-08 16:39:48.316 Flashlight[36345:40b] Greeter name: Maggie 

 created: 2011-02-09 00:39:48 +0000

(gdb) 

</code>

With NSZombieEnabled = YES, I got:

2011-02-08 16:45:05.175 Flashlight[36458:40b] Greeter name: Maggie 

 created: 2011-02-09 00:45:05 +0000

(gdb) 

</code>

I only got “EXC_BAD_ACCESS” after overriding dealloc without NSZombieEnabled.

2011-02-08 16:48:20.408 Flashlight[36568:40b] Greeter name: Baci 

 created: 2011-02-09 00:48:20 +0000

2011-02-08 16:48:20.409 Flashlight[36568:40b] In Greeter dealloc.

Program received signal:  “EXC_BAD_ACCESS”.

(gdb) 

</code>

After setting NSZombieEnabled = YES with dealloc overridden, I got

2011-02-08 16:47:52.253 Flashlight[36533:40b] Greeter name: Maggie

 created: 2011-02-09 00:47:52 +0000

2011-02-08 16:47:52.253 Flashlight[36533:40b] In Greeter dealloc.

</code>

Build > Clean All Targets didn’t help. Xcode 3.2.5

Me_in_hat_pragsmall
26 Feb 2011, 04:34
Andrew Spiehler (1 post)

I’m having similar problems to Barry Jones while using Xcode 3.2.5. My console output when calling @NSLog( )@ the second time after releasing @greeter@, both before and after setting @NSZombieEnabled=YES@ in the target info dialog, is pretty much the same as he posted.

Additionally in section 6.5 when I create an iOS Window-based Application from the project template, I don’t get an app delegate with an @applicationDidFinishLaunching:@ method, I get this instead:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    
    // Override point for customization after application launch.
   [self.window makeKeyAndVisible];
   
   return YES;
}

That method gets executed in favor of @applicationDidFinishLaunching:@ if both of them exist in the delegate.

You must be logged in to comment