cocoa

Cocoa Graphing/Plotting Framework that Works on iPhoneOS

Hello All, Looking at adding some data graphing to a new iPhone app in development (ala the Stocks app). I realize I could buckle down and do some Quartz drawing but I'm hoping that someone somewhere has a tip on a Cocoa graphing framework that works on iPhoneOS. Any suggestions? It would be a shame to re-invent the wheel if it's out ...

How do you find the amount of free space on a mounted volume using Cocoa?

I am using the following code to determine free space on a volume. The folder was provided using NSOpenPanel. The item selected was a mounted volume and the path returned is \Volumes\Name NSDictionary* fileAttributes = [[NSFileManager defaultManager] fileSystemAttributesAtPath:folder]; unsigned long long size = [[fileAttributes object...

NSColor and NSGradient as properties - any reason to copy?

I'm quite familiar with the reasons for wanting to copy a property vs. retain. (Essentially the value vs. relationship argument. You almost always want to copy strings, for example.) What about NSColor and NSGradient? They both conform to NSCopying, but as currently implemented, are immutable. Thoughts? ...

Cocoa 10.5 multithread app runs slowly

Got a Cocoa video capture app that works fine in 10.4. It uses NSThread to start the video capture driver. When app just started, video capture is very slow ( 1-2 fps). But after resize the UI window (or bring the window from background to foreground), video capture speed is back to normal. This only happens in 10.5. ...

Converting plist to binary plist

Apple strongly recommends using the binary plist format when reading large XML-based data sets into iPhone apps. Among their reasoning is the fact that XML parsing is very taxing on the iPhone. However, this requires that files residing on the remote web server be converted first. For frequently-changing content, it is not acceptable to...

Cocoa: NSURLConnection not attempting an HTTP Request

I've had significant success with NSURL, NSURL[Mutable]Request, NSURLConnection with my iPhone applications. When trying to compile a stand alone Cocoa application, 10 line program to make a simple HTTP request, there are zero compiler errors or warnings. The program compiles fine, yet the HTTP Request is never made to my web server (I'm...

Creating an OS X Service

I'm trying to create an OS X Service. I found Providing System Services in Apple's documentation, however I'm finding it less than clear on what exactly I need to do. I'm currently using an application to register my service (thinking that would be more straight forward - eventually I'd like to create a .service), however even after a lo...

What are alternatives to Objective-C for Mac programming?

I've become very comfortable in the world of pointer-free, garbage-collected programming languages. Now I have to write a small Mac component. I've been learning Objective-C, but as I confront the possibility of dangling pointers and the need to manage retain counts, I feel disheartened. I know that Objective-C now has garbage collectio...

Cocoa/WebKit, having "window.open()" Javascipt links opening in an instance of Safari

I am building a really basic Cocoa application using WebKit, to display a Flash/Silverlight application within it. Very basic, no intentions for it to be a browser itself. So far I have been able to get it to open basic html links (<a href="..." />) in a new instance of Safari using [[NSWorkspace sharedWorkspace] openURL:[request URL...

Do I have to learn Objective-C for professional Mac Development?

Do I really have to learn Objective-C to develop solid Mac Apps? As Mac users tend to use only applications that have a nice (native) GUI, i don't think that Mono and GTK+ or any Java GUI (Swing) will fit their needs. There are projects like Cocoa#, PyObjC and RubyCocoa, but are they ready for primetime? So do I really have to learn O...

How do I collect key input in a video-game style Cocoa app?

I'm hacking on a simple Cocoa app to make blocks move around the screen like a video game. I need to detect key presses, but I'm not going to have text entry fields like a dialog box would have. How do I get key presses without text controls? In particular, I need to get arrow keys. ...

Cocoa bindings problem; bound table columns don't show any data, no errors in console

I'm having trouble converting my Cocoa project from a manually-synched interface model to a bindings model so that I don't have to worry about interface glue code. I followed the CocoaDevCentral Cocoa Bindings tutorial to make sure that I had covered all the bases, but things aren't working correctly. I have a master-detail interface, ...

Updating sqlite3 API for Objective-C

I want to update/upgrade the standard Leopard install of Sqlite3 to >3.5 to use the new sqlite_xxx_v2 methods from a Cocoa project. I can't seem to find any information on how to do this. Does anyone have any tips or a site that outlines the update procedure. Also is 3.5+ supported on the iPhone. I understand it's embedded so shouldn'...

Mac OS X - System Preference Pane won't open

I'm working on a System Preferences Pane. It opens fine on some computers, but on other Macs (all running 10.5.5), the preference pane refuses to load and simply hangs, spitting the following into the console: 11/9/08 8:38:50 PM [0x0-0x31031].com.apple.systempreferences[369] Sun Nov 9 20:38:50 Macintosh.local System Preferences[369] <Er...

Should I use Cocoa bindings for my latest project?

I'm starting a project which I think would benefit from bindings (I've got a source list table, several browser views, etc), but I think it would also be quite doable, and perhaps more understandable, without them. From my limited experience I've found bindings to be difficult to troubleshoot and very "magic" (e.g. it's difficult to inse...

Is it possible to access the previous/current value of a proxy object using KVO?

I've got an NSArrayController, and I'm using KVO to observe the Old/New values of it's selection method. This works perfectly (triggers when the selection changes, the usual) except that the items in the change dictionary are all null instead of being the old/new selected object. [arrayController selection] still returns the proper obje...

Setting the background of NSBox to a gradient programmatically without subclassing

I want to set the background of an NSBox to be a gradient. In Interface Builder it is possible to set the background color of an NSBox to selectedMenuColor which is a gradient. NSBox only has a setFillColor method so how is Interface Builder filling it with a gradient? How do I programmatically fill an NSBox without subclassing it? I...

Persistent Connection to Web Server (Like AJAX on Web)

I am wanting to create a program that talks with a Cometd server to allow for pushing of data to the app. I have done this on the web side using AJAX, but I am a little unsure of the best way to do this with Cocoa. I can make a standard connection using NSURLRequest and NSURLConnection, but how do I keep this connection alive so I can ...

Weird bindings issue

I'm trying to use a browser view with bindings to represent some data and I'm getting an error message: 2008-11-11 17:22:28.636 BrowserViewTest[18269:813] Cocoa Bindings: Error accessing value for key path arrangedObjects.projects of object <NSTreeController: 0x1321e0>[object class: BillingCode] (from bound object <NSBrowser: 0x126930...

NSURLConnection chunked encoding upload - How?

I need to create a way to upload a bytestream using chunked encoding. I have a byte array that contains an audio file, I would like to send that file to a server using a chunked stream. I've been able to do a chunked upload via a native socket but I would really like to do this via one of the NSURL (NSURLConnection?) libs. Is that poss...