objective-c

Why do Programmers Love/Hate Objective-C?

So I have noticed that there is a lot of animosity towards Objective-C among programmers. What's your take? Is it a vendor lock-in thing against Apple? General antipathy towards Apple? The syntax? What's your view on this? With the advent of the iPhone SDK, Obj-C has gotten a lot more attention lately, and I am curious what people on SO...

In obj-c is possible to get the parent instance of a property ?

I wonder if is possible in obj-c to acces the parent instance from a property, like: @interface AObject : NSObject { } -(void) sample{ NSLog("%@", [[self parentInstance] Id]); } @interface DbObject : NSObject { NSInteger Id; AObject* ob; } ...

What is better: Global string or singleton?

For my brand new ORM (chibi-ORM) I face a desing decision. I'm building the API for relationships, like: @interface SamplePerson : DbObject { NSString *name; DbObjectRelation *cities; } Now, for DbObjectRelation I have this mockup: @interface DbObjectRelation : NSObject { NSMutableArray *childRows; DbObject *pare...

Getting Started with C and Objective-C

I am eventually wanting to program in Objective-C to write programs for OS X and possibly the iPhone. I do not have any direct experience with C and I come from a web programming background. I am much more familiar with java syntax than C and Objective C. I am just looking for suggestions on how to get started. It looks like I need t...

Error "Couldn't discover the 'ccc-analyzer'" when running scan-build

Hi, I'm triying to find leaks in my project chibi-ORM using the tool of scan-build as suggested in other threads. But when run from the terminal: /Users/mamcx/Downloads/checker-0.138/scan-build -k -V xcodebuild I get this: 009-01-13 10:33:18.296 xcodebuild[14025:4213] Warning: Couldn't discover the 'ccc-analyzer' compiler's built-...

What is the difference between #import and #include in Objective-C?

What are the differences between #import and #include in Objective-C and are there times where you should use one over the other? Is one deprecated? I was reading the following tutorial: http://www.otierney.net/objective-c.html#preamble and its paragraph about #import and #include seems to contradict itself or at least is unclear. ...

I must enclose object creation/release with try/finally?

In Delphi, is normal do this: ob = TObject.create; try //code finally ob.free; end; I wonder if that is similar in Obj-c. ...

Exist a generic library of validators for obj-c?

I wonder if already exist a generic library of validator suitable for a iPhone project (or better, bussines objects) for obj-c. Things like: Validator.IsNotEmpty.. Validator.IsValidEmail.. Validator.IsValidZipCode.. Validator.IsValidRegex.. Validator.IsInRange.. ...

Porting Windows library using Qt to MacOSX, event loops

Hi, I'm inserting a hook in the MFC message loop so that the Qt events are treated, without running ->exec() on qApp (because it's blocking): LRESULT CALLBACK myHookFn(int ncode, WPARAM wparam, LPARAM lparam) { if (qApp) qApp->sendPostedEvents(); return CallNextHookEx(0, ncode, wparam, lparam); } and int argc = 0; new QAppli...

Techniques for implementing -hash on mutable Cocoa objects

The documentation for -hash says it must not change while a mutable object is stored in a collection, and similarly the documentation for -isEqual: says the -hash value must be the same for equal objects. Given this, does anybody have any suggestions for the best way to implement -hash such that it meets both these conditions and yet is...

Objective-C Delegation Explained to a Java Programmer

I am fairly new to Objective-C, but experienced in Java. Is there the equivalent concept of Objective-C "delegation" in Java, so that I may understand this notion better? Would there be a way to emulate the delegation concept in Java? ...

iPhone SDK: Play a single WAV from a button.

I am currently trying out this code: # NSString *path = [[NSBundle mainBundle] pathForResource:@"dream" ofType:@"m4a"]; # AVAudioPlayer* theAudio=[[AVAudioPlayer alloc] initWithContentsOfURL:[NSURL fileURLWithPath:path] error:NULL]; # theAudio.delegate = self; # [theAudio play]; However, the SDK says that the ViewController does...

Best regex library for iphone sdk app?

Hi, I'm confused about the regex librarys that can be available for the iphone. For example RegexLite look like need a dinamyc link, nad as I understood this is not possible for the sdk on the iPhone. I wanna a regex library for do data validation... which one is the best available? ...

Programming test for hiring iPhone developers

My company is starting a new branch with IPhone development and we need to hire a developer. I like to test this person in his/her skills in iPhone developement (Objective-C etc) and general programming skills. iPhone programming skills is not a must to apply for this job but I still like a have a iPhone/Obj-c theme on the questions...

How can I create a count down Timer for cocos2d ?

Hello, I am developing a 2d iphone game by using cocos2d. I need a countdown timer. Plz tell me, How can I create a count down Timer in cocos2d ? ...

Game programming on Objective-C and linux

I'd like to give Objective-C a try in game programming. The problem is I'd need some tools and libraries for this. First thing that comes into mind I need is the GUI and graphics library. What choices do I have? ...

Using one NSArrayController from multiple XIBs

I'm having some problems displaying the contents of one NSArrayController in two windows defined in different XIBs. In my main window (in MainMenu.xib), I have an NSTableView which is bound to an NSArrayController In my second XIB, I have another window that contains an NSTableView. I created a new NSArrayController, and bound the tabl...

What is -[NSString sizeWithFont:forWidth:lineBreakMode:] good for?

In my question "How do I get -[NSString sizeWithFont:forWidth:lineBreakMode:] to work?", I learned that -[NSString sizeWithFont:constrainedToSize:lineBreakMode:] was actually what I needed. The documentation for -[NSString sizeWithFont:forWidth:lineBreakMode:] states explains it doesn't actually wrap the text to additional lines. So ho...

Implementing Delegate Pattern in Objective-C

I am building a class that handles NSURLConnection requests. To allow other classes to use this class, I would like to allow the main class to call a delegate when connectionDidFinishLoading is fired. I've looked through lots of documentation, but I can't find anything that gives any clear examples, and the code that I have doesn't cal...

Why is Xcode 3 displaying multiple compiler errors or warnings for each that actually occurs.

When I build in Xcode, any errors or warnings are being duplicated. So in the IDE, I get twice the number near the icons in the status bar, and where the yellow or red bubbles show up in the editor, there are two warning lines (or error lines) below the line where the warning (or error) occurred. Anyone else have this problem, or know ...