cocoa

Programmatically stream audio in Cocoa on the Mac

How do I go about programmatically creating audio streams using Cocoa on the Mac. To make, say a white-noise generator using core frameworks on Mac OSX in Cocoa apps? ...

CPAN/gem-like repository for Objective-C and Cocoa?

Is there any centralized repository of useful Objective-C / Cocoa libraries as there is for Perl, Ruby, Python, etc.? In building my first iPhone app, I'm finding myself implementing some very basic functions that would be just a quick "gem install" away in Ruby. ...

How to call an Objective-C method from Javascript in a Cocoa/WebKit app?

I have a Cocoa app that uses a WebView to display an HTML interface. How would I go about calling an Objective-C method from a Javascript function within the HTML interface? ...

OSX Security Framework NameAndPassword sample application

I am investigating security plugins using SFAuthorizationPluginView under Mac OSX and as a first step looking at the NameAndPassword sample application. The app builds OK but I cannot get it to authenticate. So does anyone have any experience of SFAuthorizationPluginView or any other examples. ...

Is there any benefit to using Cocoa's version of MVC with .NET?

There's a diagram depicting the difference between traditional MVC and Cocoa MVC here: Cocoa Design Patterns: The Model-View-Controller Design Pattern Are there any benefits of doing it the "Cocoa" way in .NET using Visual Studio? ...

What is a better way to create a game loop on the iPhone other than using NSTimer?

I am programming a game on the iPhone. I am currently using NSTimer to trigger my game update/render. The problem with this is that (after profiling) I appear to lose a lot of time between updates/renders and this seems to be mostly to do with the time interval that I plug into NSTimer. So my question is what is the best alternative...

how to check if a folder exists in objc?

How to check if a folder exists in objective-c? ...

Memory Management in Objective-C

I come from a C/C++ background and the dynamic nature of ObjectiveC is somewhat foreign to me, is there a good resource anyone can point me to for some basic memory management techniques in ObjectiveC? ex. retaining, releasing, autoreleasing For instance, is it completely illegal to use a pointer to an Objective C object and treat it as...

filtering NSArray into a new NSArray in objective-c

I have an NSArray and I'd like to create a new NSArray with objects from the original array that meet certain criteria. The criteria is decided by a function that returns a BOOL. I can create an NSMutableArray, iterate through the source array and copy over the objects that the filter function accepts and then create an immutable versio...

Best way to remove from NSMutableArray while iterating?

In Cocoa, if I want to loop through an NSMutableArray and remove multiple objects that fit a certain criteria, what's the best way to do this without restarting the loop each time I remove an object? Thanks, Edit: Just to clarify - I was looking for the best way, e.g. something more elegant than manually updating the index I'm at. For ...

How can I dynamically create a selector at runtime with Objective-C?

I know how to create a SEL at compile time using @selector(MyMethodName:) but what I want to do is create a selector dynamically from an NSString. Is this even possible? What I can do: SEL selector = @selector(doWork:); [myobj respondsToSelector:selector]; What I want to do: (pseudo code, this obviously doesn't work) SEL selector = ...

How to view contents of NSDictionary variable in Xcode debugger?

Is there a way to view the key/value pairs of a NSDictionary variable through the Xcode debugger? Here's the extent of information when it is fully expanded in the variable window: Variable Value Summary jsonDict 0x45c540 4 key/value pairs NSObject {...} isa 0xa06e0720 I was expecting it to show me each element of the...

How can I trigger Core Animation on an animator proxy during a call to resizeSubviewsWithOldSize?

I have some NSViews that I'm putting in one of two layouts depending on the size of my window. I'm adjusting the layout when the relevant superview receives the resizeSubviewsWithOldSize method. This works, but I'd like to animate the change. So naturally I tried calling the animator proxy when I set the new frames, but the animation ...

How can I upload a photo to a server with the iPhone?

I'm writing an iPhone app that takes a photo and then uploads it to a server. How do I upload a photo to a server with Cocoa in Xcode? I suppose I use NSUrl somewhere. Thanks! ...

Make OSX application respond to first mouse click when not focused

Normal OSX applications eat the first mouse click when not focused to first focus the application. Then future clicks are processed by the application. iTunes play/pause button and Finder behave differently, the first click is acted on even when not focused. I am looking for a way to force an existing application (Remote Desktop Conne...

setPrimitiveValue:forKey: and to-many relationships

Apple's documentation on -setPrimitiveValue:forKey: is vague in two ways when using it to manage to-many relationships. First they state: If you try to set a to-many relationship to a new NSMutableSet object, it will (eventually) fail. Eventually?! What does that even mean? Will it fail later during -[NSManagedObjectContext save:]...

Cross-model relationships in NSManagedObjectModel from merged models?

Is it possible to model relationships between entities that are defined in separate NSManagedObjectModels if the entities are always used within an NSManagedObjectModel that is created by merging the relevant models? For example, say model 1 defines an entity Foo with relationship (one-to-one) toBar and that model 2 defines an entity Ba...

What are some good resources for learning Objective-C?

I've been using Objective-C for about 6 months, and have a good grasp on the basic concepts. What are some resources (websites, PDFs, Books, Blogs, etc) to advance past this level? ...

Java Developer meets Objective-C on Mac OS

I have developed in C++ many years ago, but these days I am primarily a Java software engineer. Given I own an iPhone, am ready to spring for a MacBook next month, and am generally interested in getting started with Mac OS developmentmt (using Objective C), I thought I would just put this question out there: What Next? More specificall...

How can I create a status bar item with Cocoa and Python (PyObjC)?

I have created a brand new project in XCode and have the following in my AppDelegate.py file: from Foundation import * from AppKit import * class MyApplicationAppDelegate(NSObject): def applicationDidFinishLaunching_(self, sender): NSLog("Application did finish launching.") statusItem = NSStatusBar.systemStatusBar().stat...