cocoa

How do I make an NSPopupButton that has a menu with images AND text?

I have a list of applications and I'd like to make an NSPopupButton that shows a menu of application names with their icon to the left of each item. I've been able to bind the NSPopupButton to my array of items, but there isn't a binding entry for an image. I thought I could put a cell in there and bind the cell as an image and as text,...

Releasing NSArray containing NSDictionary objects

I am having difficulty getting my head around memory management in the following segment of code on iPhone SDK 3.1. // Create array to hold each PersonClass object created below NSMutableArray *arrayToReturn = [[[NSMutableArray alloc] init] autorelease]; NSArray *arrayOfDictionaries = [self generateDictionaryOfPeople]; [arrayOfDiction...

NSURLConnection Not Returning Data

I have a rather unusual issue here. The code below is running fine and the data is sending to the source fine, but none of the NSURLConnection triggers are returning anything. The only items being logged are in the function that the request is sent in. Any ideas? // code starts above here NSData *myRequestData = [ NSData dataWit...

Segmenting code into multiple source files

Hi, I've often read about the desirability of splitting large (monolithic?) blocks of app code up into separate source code files to make it easier to maintain etc., but I haven't yet seen anything explaining exactly how to do this. The process of creating separate files is straightforward enough when adding a subclass of course -- and...

NSTableView handling edititng cells correctly

Hi All, I have an NSTableView working correctly except when I'm editing one of the table items. If the user is still in edit mode, and it presses the Sheet OK button, the tableiew doesn't update. How do I force the tableview to commit the changes when the user press the ok button (closesheet). Also, how do I handle the ESC Key to cance...

How to properly cascade delete managed objects in Core Data?

I have a Core Data model which has three entities: A, B, and C. A has a one-to-many relationship with B, and B has a many-to-many relationship with C. The delete rule for A -> B is "Cascade", and B -> A is "No Action". The delete rule for B -> C is "No Action", and C -> B is "Deny". I am having trouble performing a delete on the A entit...

NSDate constant for Fetch Predicate

I'm using the Fetch Predicate in the IB to filter our the default result return from Core Data and I'm actually looking for some like this: dateCreated < YESTERDAY where "YESTERDAY" is supposed to be a nsdate constant for yesterday so that all my result return is before yesterday. This didn't work. And some searching didn't turn up a...

How to pass an arbitrary AppleScript Record to Cocoa in a scriptable app?

I have a Cocoa application with an AppleScript dictionary described in a .sdef XML file. All of the AppleScript classes, commands, etc. defined in the sdef are working property. Except for my "submit form" command. The "submit form" command is my only command attempting to pass a parameter that is an arbitrary hashtable of information f...

Updating NSTableView when enitiy is added to core data

I have a Cocoa App that I have manually added core data to. I setup the table in Interface Builder to list the entities from the data (with NSArrayController), and this is working just fine. The problem is when I insert a new entity (via code) the table does not update until I restart the app. What do I have to do after inserting an en...

EXC_BAD_ACCESS in SQLite on Mac OS

I'm pulling and pushing data from an sqlite database. I use the FMDatabase cocoa wrapper. I'm pulling and pushing data from multiple threads, but I made sure that more then one transactions never happen at the same time. I get EXC_BAD_ACCESS after a few hundred call at the database but never at the same time. It's also not memory rela...

How to programmatically set the value of a WebKit password text field?

Update: this question is bunk. Move along, nothing to see here. You can set the value of the password text field from either JS or ObjC. I was wrong. I have a WebKit-based Cocoa app which loads an HTML document containing an HTML form in a WebView. The HTML form contains a password text field like: <form name="foo"> <input type="pa...

NSURL URLWithString: is null with non-english accented characters

I have the following string... NSString *googleSearchString = @"http://www.google.com/search?q=lyrics+%22Tænder+På+Dig%22+%22Jakob+Sveistrup%22"; Notice that it has some accented characters. When I try to turn that into a url the returned url is null... [NSURL URLWithString:googleSearchString]; So normally the url works except when...

Core Data is using a lot of memory

I have a data model which is sort of like this simplified drawing: It's a little weird, but the idea is that the app manages multiple accounts/identities a person may have into a single messaging system. Each account is associated with one user on the system, and each message could potentially be seen/sent-to multiple accounts (but th...

NSConcreteNotification is received, but not defined?

I'm writing preferences for my app which registers it for launch at login (using LSSharedItemList API). All goes fine and my app toggles its presence in user's login items upon checkbox status. Now I want to tackle another problem when user actually removes the app from "Login items" in Accounts.prefPane. Using Notification Watcher I se...

How to store (and use) the current mouse position?

What is the best way to store the current mouse position (system-wide) and then (later) put the mouse at that stored point? [NSEvent mouseLocation] gets me the position, and I can move the mouse with a CGEventMouseMoved, but they each use a different co-ordinates system (I believe y=0 is the top for NSEvent and the bottom for a CGEvent)...

How to use notificationconf?

Hello! I have read THIS tutorial about creating Push nodes and posting/subscribing to notifications. The only problem I have met is that it seems that notificationconf unable to create that node... My first question: are nodename (parameter of notificationconf tool) and notificationName (NSString which I use from app) the same things...

string/number from TextField to be used for calculation???

Hi, sorry for my question and for the long explanation following here, probably there's a simple solution for someone who is experienced in Cocoa and Objective-C, but I'm just starting few weeks ago and I can't figure out how to get this thing working, Grrrrrrr!! OK, let's put it like this, in my window I have the following: 2 TextFie...

How to log an long long value with NSLog?

How can I do that? What's the format specifier? For example, I have: long long veryLong = // assume value here NSLog(@"%f", veryLong); // of course wrong... ...

How do you create a Keynote-like interface in Cocoa and IB?

Hi again, the app I want to create will have an interface very like Keynote, with a list of pages on the left and one page in full on the right. These kinds of interfaces are very common yet I don't know how to do them in Interface Builder. Are there any ready-made components? Apple doesn't offer any, afaik. Or does every developer re...

IBPlugin and paths to framework

IBCocoaSimulator crashes when IB cannot find the framework, I assume that happens to you too. I can run IBCocoaSimulator without crash, when I manually copy my framework+ibplugin from the build dir into /Users/username/Library/Frameworks. I'm doing this with Finder, this is not optimal, but works. I have searched for a smarter way and ...