cocoa

Getting started with cocoa for os x?

I am familiar with iOS programming, but I don't know where to put my logic when I start a Cocoa project for OS X. Are there any good online resources for transitioning to OS X from iOS? EDIT: Thanks for the help so far. My main question is where my code goes in the default template. ...

Draw into Fullscreen GL Context

Ok this is a little tricky. I'm detecting when an application goes into fullscreen mode (captures the display) and then i need to draw occasionally some stuff into the captured displays context for notification purposes (like Growl notifications, but has to work in fullscreen mode too). Is there any way to modify another apps GL/CG cont...

warning: Attempting to create USE_BLOCK_IN_FRAME variable with block that isn't in the frame.

What does mean? I get this error when trying to iterate through a file in Cocoa obj-c. I can't find any information on the web. Would appreciate some help. Thanks. EDIT I've been following this tutorial (link) to preload Core Data. I've tried creating a Cococa application and have also tried doing this from within my iPhone app. I ...

How can i show an NSImage in front of a NSTextFieldCell in a NSTableView

I display a file list and want to show the file icon and editable file name in a NSTableColumn. Also what would be the best way to display an additional NSImage immediately behind the file name (i mean not adding an additional column at the right side for the second icon). ...

How to copy a file to portable drive root with cocoa?

I've tried the following [[NSFileManager defaultManager] copyItemAtPath:@"whatever.txt" toPath:@"/Volumes/MyDrive" error:&copyError]; This gives me the error "The operation couldn’t be completed. File exists" If I try to copy it to "/Volumes/MyDrive/testFolder" everything copies to testFolder just fine. ...

NSString to NSDate with float values

Hello, I'm developing an OS X desktop application which will track time for a car racing event. The difference between pilots can be very small, so the collected data for each lap has a floating point value for the seconds: bestLap = @"00:01:39.5930000" But I need to compare each pilot's time and sort it. I'm trying to convert it to...

How do I persist data managed by NSArrayController without Core Data or NSKeyedArchiver?

I hope you'll excuse the seemingly broad nature of this question, but it gets quite specific. I'm building a document-based Cocoa application that works like most others except that I am using SQLCipher for my data store (a variant of SQLite), because you don't get to set your own persistent data store in Core Data, and also I really ne...

Displaying custom/arbitrary controls in an NSMenu

How can I Display an NSTextField or an NSProgressIndicator within an NSMenu? I'm looking to do something similar to the Spotlight icon menu, or the Help menu of most applications. ...

How to unit-test an internet protocol implementation?

I decided to add unit tests to my project and continue development in a test-driven kind of way. I’m currently working on implementing unit tests for my ManageSieve client object and I’m not sure what’s the best way to test that beast. My SieveClient object relies on two other objects for the network communication: CocoaAsyncSocket and ...

KeyDown event and drag'n'drop

Can i capture keyDown event when user drops a file on application icon in the dock? For example, if user drops on application icon some files, that's handle with "method_one". And if user drops on application icon some files and holding the option key, that's handle with "method_two". And all "UI" in this application it's just a dock ...

Cocoa osx: Add a menu item on dock elements for all running applications

I'm working to an application for OSX and I would to add a new menu item on the menu shown when you click on a dock icon. The menu isn't for my application but it must appear for all running apps. I've found only this doc http://cocoadevcentral.com/articles/000036.php but it adds to its own app. My app will run on OSX 10.6 or superior ...

Changing text color of NSTextView in Interface Builder won't work

Hello, I can set background color for NSTextView, also insertion color, but when I try to change text color it just doesn't work. I can set the color programmatically before each insert of text, but I'm probably doing something wrong, since Interface Builder offers this options. Here's what my inspector looks like: ...

Progress bar/spinner not working in cocoa

Hello, I'm using an NSProgressIndicator and it only redraws after the main event loop. The spinner however never starts or stops. I am using the following code to start the progress indicator: [progressIndicator startAnimating]; It is also synthesized, and included properly in the .h and .m files. I have connected it in IB. The c...

Symbol not found: _OBJC_CLASS_$_NSURL error when launching on Mac OS X Leopard

I've just gotten a report from a user that a new build of my app crashes on his machine when he tries to launch it. The crash report is: Process: MyApp [222] Path: /Applications/MyApp.app/Contents/MacOS/MyApp Identifier: com.MyCompany.MyAppAppAndImporter Version: ??? (???) Code Type: X86-64 (Native...

How do you read/write/update m4u and mp3 file meta data using cocoa/objective c?

Are there some particular library files available on OS/X that are relevant, I am just not sure where to start. ...

HTML-like view in Cocoa?

Hello there, learning Cocoa can be pretty tough for web developers. Some things are so simple in HTML, and I have no idea, how to do this in Cocoa. Let me just show you an image here, to show you what I have on my mind. So it's kinda like a blog. Each post has variable length, so it can take up some space. Also, you're able to scrol...

NSMutableDictionary error

I want to use NSMutableDictionary to cache some data i will use later. My custom object is following: @interface MyData : NSObject { NSRange range; NSMutableArray *values; } @property (nonatomic, retain) NSMutableArray *values; and implement: - (id)init { if (self = [super init]) { values = [[NSMutableArray alloc]...

How do I bind an NSMutableString to the value of an NSTextView?

Ok, so I'm trying to set up a very simple program for myself in Xcode. I have a window (in Interface builder) which contains an NSTextView, and an NSButton. Inside my AppController class, I have declared an NSMutableString as a property. What I want to do is to set an initial value for the string, say @"First Entry\n", then, bind it to ...

Unexplainable NSUndoManager crash / assert in Cocoa app

Hi. I'm having a weird issue, with a Cocoa, OpenGL application I am working on. Whenever I launch my application I am getting the following messages / assertion failure on the console, related to eh NSUndoManager. I am not using the undo manager, by the way. 2010-09-05 03:28:49.184 CocoaCoreTest[51721:a0f] *** Assertion failure in +[NS...

How to store and retrieve a custom class

NSUserDefaults won't accept custom classes. So how can these objects be stored and retrieved? ...