cocoa

Project without an .xcodeproj directory, how to open?

I'm finding a few open source projects, mostly older, that lack an .xcodeproj directory hierarchy. It seems like all other crucial files are there. Curiously enough, I'm wondering how these projects are even accessed via Xcode? I'd like to compile them, break them, fix them etc. Is there a way to open these more legacy projects? Here'...

How can my app detect a change to another app's window?

In Cocoa on the Mac, I'd like to detect when a window belonging to another app is moved, resized, or repainted. How can I do this? ...

Using predicates on an array controller to filter related objects

I have an application using Core Data and bindings. I want to have an NSSearchField that can search through an NSArrayController bound to an NSTableView. The array controller contains Core Data objects that have a "name" field. I have setup the NSSearchField like this: Bind To: the array controller Controller Key: filterPredicate Pre...

Cocoa Control/View for displaying list of directories

I'm new to Cocoa development - I want to display an aribitrary number of directory paths in a control/view. What's the best type of built-in control/view for this? Requirements: This should be a flat list only and not a full File System browser. Users should be able to select one (or more) items and remove them (i'll provide a remov...

IBOutlet not getting set in Cocoa MVC project

I might not be using IBOutlet correctly, or some other subtlety with how NIB files work is causing me trouble - any help would be much appreciated (feel free to propose an alternate way to accomplish what I want). I have a View object and a Controller object. Both are in the NIB. The Controller's init is also called when the NIB is load...

Force HTTP v1.0 request with NSURLConnection

NSURLConnection by default performs a GET request with HTTP v1.1. How do I get it to perform a GET request with HTTP v1.0? Or is there a HTTP header I can set that will do this for me? ...

Is [NSString hash] computed every time?

If I have an immutable string is the hashing algorithm run every time I call hash, or does it remember the value (given that the string can't change)? ...

Loading NIB file using NSWindowController doesn't set window or top level objects

I have a NIB file that I load using NSWindowController initWindowNibName. The NIB file contains one NSWindow. It's File's Owner is of class NSWindowController. I've connected the window outlet from File's Owner to the Window. When I load the NIB, [windowController window] is nil and so is the top level objects array. However, I can stil...

Copy Protection (mac apps): most cost effective solution??

... after having just read http://www.cocoadev.com/index.pl?CocoaInsecurity ... I am curious to know about your experiences with copy protection solutions for protecting macintosh applications. Is it worth investing any time in at all? OR Is it worth investing money in a commercial solution? (& if so, which?) please consider in your a...

How to get bitrate of audio file in cocoa

I need to get bitrate information from audio files, for some reason AudioFileGetProperty function with kAudioFilePropertyBitRate constant always returns 0 for me. The same with kAudioFilePropertyInfoDictionary, the resulting dictionary doesnt contain bitrate info. I would try to manualy get this from raw data in case of mp3, but I need t...

Cocoa Foundation Kit question - NSDecimalNumberBy...:withBehavior:

I'm trying to take a numeric value in a string and raise it by a power of 10. stumbled upon – decimalNumberByMultiplyingByPowerOf10:withBehavior: which looks promising but I can't for the life of me figure out how to configure/set the withBehavior argument. I think I need to set it to NSRoundDown so when raising to negative power it ...

What GUI options are available for Python on Mac OS X?

Is there like an AIR for python? I know I can use Cocoa with Python, is there anything else? How easy is it to get started with Cocoa for Python if you know Python. ...

Updating the image of a NSStatusItem

I have a statusItem in the StatusBar. I've retained a reference to it in my class. Now, I want to update the image of the item. In order to this, I wrote a method similar to: -(void)updateStatusIcon:(NSString *)newImage { [statusItem setImage:[NSImage imageNamed:newImage]]; } The image is a valid icon and works when I set it initi...

Open string in app per drag'n'drop on icon

Hey! My idea: I select a string/text and drop it on my app's icon. My app comes up and does fancy things with the string. Now my question is how I can do it that I can drop it on the app, how I can notify my app and how my app gets the string. Any suggestions? Thanks for answering and any idea! :) ...

How can I make an undecorated window in Cocoa?

I like to create a Cocoa window without any chrome whatsoever. The only thing the user should see is what I draw. I've discovered I can create a custom NSView but does this have to be in an NSWindow to display? If not, how can I display it without putting it in an NSWindow? If it does have to be in an NSWindow, how do I stop the window ...

Under what circumstances would [[NSScreen mainScreen] visibleFrame] return null?

I want to get the dimensions of the main screen, so I use this snippet: NSLog(@"mainScreen frame = %@", [[NSScreen mainScreen] visibleFrame]); It's printing mainScreen frame = (null) Earlier it was printing the expected dimensions of my main monitor. What are some possible causes of this? ...

Is there an easy way of sorting a plist (array of dictionaries) by key value?

I need to reorder a plist (an array of dictonaries) by Key value. In this example content I'd like to order by the value for the key Name (Matt, Joe): <dict> <key>Name</key> <string>Matt</string> <key>Details</key> <string>Me</string> </dict> <dict> <key>Name</key> <string>Joe</string> <key>Details</key> ...

How to print and use constants with gdb (through xcode) ?

I am debugging a Cocoa application using xcode-gdb. I am at a break point and I want view the value of some Cocoa constants (ie NSControlKeyMask) and to do some test with the values in the current stackframe. Specifically I am in - (void) keyDown:(NSEvent *) e , and I have done set $mf = (int)[e modifierFlags] on the gdb prompt. Now ...

How do I fix my application from leaking when using Qt 4.5?

Without any changes to my code except building against Qt 4.5 I get the following warning message when I run my application: *** _NSAutoreleaseNoPool(): Object 0x50a1b0 of class NSCFNumber autoreleased with no pool in place - just leaking I am not using any Objective-C in my code but Qt 4.5 is using a new Cocoa based back end instead ...

Why am I getting an isEqualToString error in this Cocoa code?

I keep getting this error: What is it? I never even called "isEqualToString". Here Is my Joke.M @implementation Joke @synthesize joke; @synthesize rating; - (id)init { [super init]; return self; } - (void)dealloc { [joke release]; [super dealloc]; } + (id)jokeWithValue:(NSString *)joke { Joke *j = [[Joke alloc] init]; j.joke =...