Go Back   MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old Sep 11, 2006, 03:22 PM   #1
ExoticFish
macrumors 6502a
 
ExoticFish's Avatar
 
Join Date: Dec 2002
Location: The inner depths of madness, aka Kent, OH
Send a message via AIM to ExoticFish Send a message via Skype™ to ExoticFish
Help needed with Chapter 5 Challenge from Cocoa Programming for Mac OS X

I've been reading Cocoa Programming for Mac OS X and have been finding it enjoyable thus far. The challenge at the end of chapter 5 has been giving me fits however. I just can't make it work.

I've looked around online and it seems that everyone else's solutions are exactly what I'm doing but for some reason I can not get it to work.

here's a site that describes exactly how I tried to solve the problem but when I run the compiled application it does not work! I'm thinking that perhaps it could have something to do with the book's teaching of 10.3 instead of 10.4 but I've seen other people saying they were programming in 10.4

I'm trying to get this to work before I move on to chapter 6. Any help would be greatly appreciated!
__________________
20" Intel iMac 2.16GHz C2D, OS X.5
ASUS M51Sn laptop running Ubuntu/Vista
play Dofus on your Mac? try Dofex
ExoticFish is offline   0 Reply With Quote
Old Sep 11, 2006, 04:06 PM   #2
whooleytoo
macrumors 603
 
whooleytoo's Avatar
 
Join Date: Aug 2002
Location: Cork, Ireland.
Send a message via AIM to whooleytoo
Just tried (on 10.4), and works fine here.

I'd imagine the most likely problems are the window's delegate hasn't been set, or there's a typo in the windowWillResize: method name? Other than that, I can't think what could be wrong - there's not a lot of code to get wrong!
__________________
Mac <- Macintosh <- McIntosh apples <- John McIntosh <- McIntosh surname <- "Mac an toshach" <- "Son of the Chief"
whooleytoo is offline   0 Reply With Quote
Old Sep 11, 2006, 04:34 PM   #3
ExoticFish
Thread Starter
macrumors 6502a
 
ExoticFish's Avatar
 
Join Date: Dec 2002
Location: The inner depths of madness, aka Kent, OH
Send a message via AIM to ExoticFish Send a message via Skype™ to ExoticFish
ok here's what i'm doing:

* i made a subclass of NSObject called AppController, created files, and instantiate it

*AppController.h contains:

Code:
/* AppController */

#import <Cocoa/Cocoa.h>

@interface AppController : NSObject
{
}

- (NSSize)windowWillResize:(NSWindow *)sender
					tosize:(NSSize)frameSize;

@end
*AppController.m contains:
Code:
#import "AppController.h"

@implementation AppController
{
	
}

- (NSSize)windowWillResize:(NSWindow *)sender
					tosize:(NSSize)frameSize
{
	NSLog(@"calling windowWillResize");
	frameSize.width = frameSize.height * 2;
	return frameSize;
}

@end
* in Interface Builder I ctrl drag from Window in the Instances tab to the Instance of AppController and connected the delegate

What am i missing?
__________________
20" Intel iMac 2.16GHz C2D, OS X.5
ASUS M51Sn laptop running Ubuntu/Vista
play Dofus on your Mac? try Dofex
ExoticFish is offline   0 Reply With Quote
Old Sep 11, 2006, 04:41 PM   #4
whooleytoo
macrumors 603
 
whooleytoo's Avatar
 
Join Date: Aug 2002
Location: Cork, Ireland.
Send a message via AIM to whooleytoo
No, that looks pretty good actually.

I hope I don't sound condescending, but could you have forgotten to save the changes in the .nib file? Or perhaps when connecting the delegate, you clicked on "delegate" in the list, but never clicked "Connect" (or double clicked, which does the same thing)?
__________________
Mac <- Macintosh <- McIntosh apples <- John McIntosh <- McIntosh surname <- "Mac an toshach" <- "Son of the Chief"
whooleytoo is offline   0 Reply With Quote
Old Sep 11, 2006, 04:55 PM   #5
ExoticFish
Thread Starter
macrumors 6502a
 
ExoticFish's Avatar
 
Join Date: Dec 2002
Location: The inner depths of madness, aka Kent, OH
Send a message via AIM to ExoticFish Send a message via Skype™ to ExoticFish
hey I'm a noob to Cocoa to condescend away! But I did make sure to do both of those things. Here's an image of IB
Attached Thumbnails
Click image for larger version

Name:	Picture-1.jpg
Views:	95
Size:	78.8 KB
ID:	57115  
__________________
20" Intel iMac 2.16GHz C2D, OS X.5
ASUS M51Sn laptop running Ubuntu/Vista
play Dofus on your Mac? try Dofex
ExoticFish is offline   0 Reply With Quote
Old Sep 13, 2006, 12:54 AM   #6
ExoticFish
Thread Starter
macrumors 6502a
 
ExoticFish's Avatar
 
Join Date: Dec 2002
Location: The inner depths of madness, aka Kent, OH
Send a message via AIM to ExoticFish Send a message via Skype™ to ExoticFish
Ok now this is just driving me crazy. Would you mind send me your xcode project so i can test to see if it's just my machine or not? I'd greatly appreciate it!
__________________
20" Intel iMac 2.16GHz C2D, OS X.5
ASUS M51Sn laptop running Ubuntu/Vista
play Dofus on your Mac? try Dofex
ExoticFish is offline   0 Reply With Quote
Old Sep 13, 2006, 08:00 AM   #7
whooleytoo
macrumors 603
 
whooleytoo's Avatar
 
Join Date: Aug 2002
Location: Cork, Ireland.
Send a message via AIM to whooleytoo
No problem, you should find it attached.

If nothing appears different, I can provide code that would check if the window's delegate is set correctly at run-time, this would seem to me to be the most likely problem.
Attached Files
File Type: zip CocoaTest.zip (39.8 KB, 97 views)
__________________
Mac <- Macintosh <- McIntosh apples <- John McIntosh <- McIntosh surname <- "Mac an toshach" <- "Son of the Chief"
whooleytoo is offline   0 Reply With Quote
Old Sep 13, 2006, 03:56 PM   #8
ExoticFish
Thread Starter
macrumors 6502a
 
ExoticFish's Avatar
 
Join Date: Dec 2002
Location: The inner depths of madness, aka Kent, OH
Send a message via AIM to ExoticFish Send a message via Skype™ to ExoticFish
Wow

That's all i can really say.

I thank you for you help, but I found the problem finally. In my code posted here you will find my error. tosize: should be toSize:

nothing more to see here folks, move along!



seriously though, thanks for taking the time to help out a noob!
__________________
20" Intel iMac 2.16GHz C2D, OS X.5
ASUS M51Sn laptop running Ubuntu/Vista
play Dofus on your Mac? try Dofex
ExoticFish is offline   0 Reply With Quote
Old Sep 13, 2006, 04:08 PM   #9
Catfish_Man
macrumors 68030
 
Catfish_Man's Avatar
 
Join Date: Sep 2001
Location: Portland, OR
Send a message via AIM to Catfish_Man
Quote:
Originally Posted by ExoticFish
Wow

That's all i can really say.

I thank you for you help, but I found the problem finally. In my code posted here you will find my error. tosize: should be toSize:

nothing more to see here folks, move along!



seriously though, thanks for taking the time to help out a noob!
Ways to find that sort of problem:
1) use autocomplete a lot
2) read the compile warnings closely
Catfish_Man is offline   0 Reply With Quote
Old Sep 24, 2006, 07:03 PM   #10
Fairly
macrumors regular
 
Join Date: Sep 2006
Location: Cambridge UK
Off topic, but don't waste your time with that book. Get the Yacktman book instead.
Fairly is offline   0 Reply With Quote
Old Sep 24, 2006, 10:23 PM   #11
slooksterPSV
macrumors 68030
 
Join Date: Apr 2004
Location: Nowheresville
Send a message via AIM to slooksterPSV Send a message via MSN to slooksterPSV Send a message via Yahoo to slooksterPSV
Quote:
Originally Posted by Fairly
Off topic, but don't waste your time with that book. Get the Yacktman book instead.
I strongly disagree with your post, I think that Cocoa Programming for Mac OS X was and still is an awesome book. It teaches you how to use Cocoa very benefitially.

To the Poster: when you finish the book, look up online tutorials for Core Data. OMG That is crazy, it is so cool that I mean I just wow, I created 2 apps in less than 1 hour. My MDM - MoneyData Manager, I recreated that in 10 min. with CoreData, it didn't have EVERYTHING in it, but it had the basics for what I wanted to do. I also made ADM - Assignment Data Manager. -This took longer because I wasn't sure how to do something, but it just automatically worked when I tried it, so yeah.
__________________
AMD Phenom 9600, 2GB RAM, 250GB HDD, ATI Radeon 4850, Vista Home Premium 64-bit
Gateway NV53 with Windows 7 Home Premium 64-bit & Ubuntu 10.04 Lucid Lynx 64-bit
slooksterPSV is offline   0 Reply With Quote
Old Sep 25, 2006, 02:39 AM   #12
HiRez
macrumors 601
 
HiRez's Avatar
 
Join Date: Jan 2004
Location: Western US
I agree that the Hillegass book is the best introduction to Cocoa programming. However, the Anguish/Buck/Yacktman book (Cocoa Programming) is also awesome. Where Hillegass is more of a tutorial approach, Anguish is more of a reference and sample-code approach. It's an excellent, comprehensive book, the only problem is it is very out of date (it's 4 years old). I believe it was written when Jaguar (10.2) was still pre-release. That means no discussion of Cocoa Bindings, no Core Data, no Core Image, "Xcode" didn't even exist, and it has some now-deprecated API listings. I still use it from time to time though, it's a shame they don't do a fresh update to it.
__________________
Go outside, the graphics are amazing!
HiRez is offline   0 Reply With Quote
Old Sep 28, 2006, 12:12 AM   #13
aquanutz
macrumors regular
 
Join Date: May 2005
Location: Boston, MA (I miss Willoughby, Ohio)
totally off topic, but i see you're from Kent. I go to BG. <from left field>
aquanutz is offline   0 Reply With Quote
Old Oct 1, 2006, 02:29 AM   #14
ExoticFish
Thread Starter
macrumors 6502a
 
ExoticFish's Avatar
 
Join Date: Dec 2002
Location: The inner depths of madness, aka Kent, OH
Send a message via AIM to ExoticFish Send a message via Skype™ to ExoticFish
so many responses, thanks.

@aquanutz
cool, not too far away then. never been to BG although I did drive past it once while heading somewhere. only thing I know about it over there is that a friend of mine went to his first year of college there before moving back and going to Kent.
__________________
20" Intel iMac 2.16GHz C2D, OS X.5
ASUS M51Sn laptop running Ubuntu/Vista
play Dofus on your Mac? try Dofex
ExoticFish is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Similar Threads
thread Thread Starter Forum Replies Last Post
OS-neutral: Chuck's Challenge 3D: Chip's Challenge Reborn N19h7m4r3 Mac and PC Games 1 Mar 2, 2014 03:18 PM
Mac programming should be more like iOS programming. moonman239 Mac Programming 13 Feb 17, 2014 02:37 PM
develop iphone apps from PowerPoint no programming or design experience needed! kinneretsky iPhone and iPod touch Apps 0 Nov 5, 2012 02:58 AM
Good resources for Cocoa programming kaworu1986 Mac Programming 9 Jul 23, 2012 03:22 PM

Forum Jump

All times are GMT -5. The time now is 04:09 PM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC