cocoa

Understanding reference counting with Cocoa / Objective C

I'm just beginning to have a look at Objective C and Cocoa with a view to playing with he iPhone SDK. I'm reasonably comfortable with C's malloc and free concept, but Cocoa's references counting scheme has me rather confused. I'm told it's very elegant once you understand it, but I'm just not over the hump yet. I guess my question is, c...

Cocoa and Objective-C resources?

What are the recommended online or offline resources for Objective-C and Cocoa programming? My online resources: O'Reilly, Some useful articles and examples, but has not been updated for quite a while Learning Objective C, This seems like a good resource so far Late Night Cocoa Podcast, I recently discovered this one, starting on epis...

How do you name your instance/param values?

Being new to Objective-C (but a long term C/++) programmer I'm looking for advice/recommendations on naming conventions for variables. My personal preference would be to utilize a prefix for instance variables both for clarity within functions and to prevent shadowing of function parameters. However I'm a fan of properties which rules o...

Cocoa - best way to capture key events in NSTextView?

Well? I'm slowly learning Objective-C and Cocoa, and the only way I see so far to capture key events in Text Views is to use delegation, but I'm having trouble finding useful documentation and examples on how to implement such a solution. Can anyone point me in the right direction or supply some first-hand help? Thanks in advance! ...

In Cocoa do you prefer NSInteger or just regular int, and why?

I think the title says it all :) I'm new to Cocoa and while the purpose of many objects is obvious, others are not. For example NSInteger/NSUInteger/NSFloat/NSDouble are all replacements for the regular builtin types. Is there any benefit to using the NS* types over the builtins? Which do you prefer and why? Are NSInteger and int the s...

In Cocoa do I need to remove an Object from receiving KVO notifications when deallocating it?

When I've registered an object foo to receive KVO notifications from another object bar (using addObserver:...), if I then deallocate foo do I need to send a removeObserver:forKeyPath: message to bar in -dealloc? ...

Why is the PyObjC documentation so bad?

For example, http://developer.apple.com/cocoa/pyobjc.html is still for OS X 10.4 Tiger, not 10.5 Leopard.. And that's the official Apple documentation for it.. The official PyObjC page is equally bad, http://pyobjc.sourceforge.net/ It's so bad it's baffling.. I'm considering learning Ruby primarily because the RubyCocoa stuff is so muc...

Drawing a view hierachy into a specific context in Cocoa

For part of my application I have a need to create an image of a certain view and all of its subviews. To do this I'm creating a context that wraps a bitmap with the same-size as the view, but I'm unsure how to draw the view hierarchy into it. I can draw a single view just be setting the context and explicitly calling drawRect, but this...

Objective-C/Cocoa: How do I accept a bad server certificate?

Using NSURLRequest, I am trying to access a web site that has an expired certificate. When I send the request, my connection:didFailWithError delegate method is invoked with the following info: -1203, NSURLErrorDomain, bad server certificate My searches have only turned up one solution: a hidden class method in NSURLRequest: [NSURLReq...

Developer Setup for Starting Out with Cocoa/Mac Programming

I'd like to start experimenting with Cocoa and programming for Mac OSX. I'm not terribly concerned with Objective C syntax/constructs/bheaviors at this point, but more curious as to an efficient setup on in terms of an editor and/or IDE that will get me going quickly. Is there any IDE even remotely similar to Visual Studio (since that'...

Height of NSTextView with one line?

I want to programatically create an NSTextView. How can I determine the correct frame height so that the view displays one line of text in the current default font? ...

Can you use CruiseControl to build Cocoa/Objective-C projects?

Has anyone ever set up Cruise Control to build an OS X Cocoa/Objective-C project? If so, is there a preferred flavor of CruiseControl (CruiseControl.rb or just regular CruiseControl) that would be easier to do this with. I currently have a Ruby rake file that has steps for doing building and running tests, and wanted to automate this ...

InputManager on OS X

I was wondering if InputManagers are still part of Leopard and if there is a good example that would show me what are the use of it? ...

Objective-C: Passing around sets of data

A question that has pondered me for the last while. I am primarily a .net developer who dabbles in Objective-C for iPhone and Mac. How do you go about sending "datasets" between methods in objective-c. For example in C# you can populate a custom class with data and pass it around in a List of type custom class. EG if you had a customer ...

NSEnumerator performance vs for loop in Cocoa

I know that if you have a loop that modifies the count of the items in the loop, using the NSEnumerator on a set is the best way to make sure your code blows up, however I would like to understand the performance tradeoffs between the NSEnumerator class and just an old school for loop ...

Best way to export a QTMovie with a fade-in and fade-out in the audio

I want to take a QTMovie that I have and export it with the audio fading in and fading out for a predetermined amount of time. I want to do this within Cocoa as much as possible. The movie will likely only have audio in it. My research has turned up a couple of possibilities: Use the newer Audio Context Insert APIs. http://developer.ap...

What is the best way to unit test Objective-C code?

What frameworks exist to unit test Objective-C code? I would like a framework that integrates nicely with Xcode. ...

Cocoa tips for PHP developers?

I'm a PHP developer, and I use the MVC pattern, and object oriented code. I really want to write applications for the iPhone, but to do that I need to know Cocoa, but to do that I need to know Objective-C 2.0, but to do that I need to know C, and to do that I need to know about compiled languages (versus interpreted). Where should I be...

What's a good way to write a Cocoa front-end to an Erlang application?

I'm exploring the possibility of writing an application in Erlang, but it would need to have a portion written in Cocoa (presumably Objective-C). I'd like the front-end and back-end to be able to communicate easily. How can this best be done? I can think of using C ports and connected processes, but I think I'd like a reverse situation ...

Error Code Reference for OSX/Cocoa

If I get an error code result from a Cocoa function, is there any easy way to figure out what it means (other than by grepping through all the .h files in the framework bundles)? ...