cocoa

XML parses with extra whitespace

Hi I have an XML file that looks like this: <?xml version="1.0"?> <categories> <category id="1"> <category_name>Banks</category_name> </category> <category id="4"> <category_name>Restaurants</category_name> </category> </categories> The [xmlParser parse] method returns TRUE without errors. But when i print out...

How to draw a rounded NSImage

I am trying to create a NSImage or NSImageCell with rounded corners inside a NSTableView. I can't get anything to work. Here is the best I have so far inside my custom NSCell: - (void)drawInteriorWithFrame:(NSRect)frame inView:(NSView *)controlView { if (thumbnailLink) { NSURL *url = [NSURL URLWithString:thumbnailLink]; if (url) ...

How can I implement a thumbnail-based view for user selection in Cocoa?

Hi, I have what I thought was a pretty simple need but I'm not sure how to go about implementing it. At various points in my interface, the user is asked to make a selection of something rather visual (like choosing a layout for a page or a color option.) These selections are made from a pre-defined set of options. Normally you'd use an...

How to clear cookies from NSHTTPCookieStorage more then once?

My desktop app connects to a web application that's hosted on Google App engine. Once it authenticates it gets an authtoken cookie that it passes along for all future requests. That all works. But now I want to add "Sign out". I’ve tried to implement Sign Out like this: - (void)signOut { NSHTTPCookieStorage *cookieStorage = [NSHTTP...

Cocoa PDFKit Unlocking Encrypted Files

Hi all I have a PDF document that has an owner password set but no user password. Therefore it is encrypted. I know the owner password and want to use PDFKit to confirm when the document has been decrypted. I have used the PDFDocument unlockWithPassword method which returns YES when the file is unlocked. However this method also retur...

Attempt to insert nil

Seems like it should be easy to add a boolean to an NSMutableArray. Assume toDoArray is intialized as an NSMutableArray. The following: BOOL checkBoxState = NO; [toDoArray addObject:checkBoxState]; Generates the error "attempt to insert nil." What's the correct way to add a negative boolean to a mutable array? ...

decode utf8 on iphone

Hi , i have NSstring that contain encoded utf8 i want to decode it. how can i do that? i try this but it didn't work NSString *decodedString = [NSString stringWithUTF8String:[encodedString cStringUsingEncoding:[NSString defaultCStringEncoding]]]; thanks ...

keyUp event heard?: Overridden NSView method

UPDATED: I'm now overriding the NSView keyUp method from a NSView subclass set to first responder like below, but am still not seeing evidence that it is being called. @implementation svsView - (BOOL)acceptsFirstResponder { return YES; } - (void)keyUp:(NSEvent *)event { //--do key up stuff-- NSLog(@"key up'd!"); } @end --OR...

Core Data + Core Animation/CALayer together??

I am making an Cocoa app with custom interfaces. So far I have implemented one version of the app using CALayer doing the rendering, which has been great given the hierarchical structure of CALayers, and its [hitTest:] function for handling mouse events. In this early version, the model of the app are my custom classes. However, as the ...

Centering Windows on screen

Short and sweet: How can I tell Interface Builder to center a window on a user's screen? I've seen the positioning tool on the inspector, but eyeballing doesn't always land as squarely as I like. Is this something where I should switch over to Xcode and add something to the init or awakeFromNib methods? ...

Getting and Setting values from Core Data elements in Objective-C?

I've got a simple application with two entities: Person: Attributes: name Relationships: nativeLanguage: (<<-> Language.natives) nonNativeLanguage: (<<-> Language.nonNatives) Language: Attributes: name Relationships: natives: (<->> Person.nativeLanguage) nonNatives: (<->> Person.nonNativeLanguage) On the ed...

KVC select by criteria

I have a array of objects that selected from core data. I need select from this set subset of object that correspond to condition. How to do it? ...

Core Data: entity properties getting mixed

I have an NSWindow which I use to create new records. After pressing the Add button, a certain method is called in which I do the following: - (IBAction)addActionAddSheet:sender { NSManagedObjectContext *moc = [self managedObjectContext]; NSManagedObject *newObject = [NSEntityDescription insertNewObjectForEntityForName:@"Recipe" inM...

NSView in NSMenu -- how to make "key" for accepting keyboard commands [specifically, return]

I have a text field and a button living in a view inside a menu item. The button submits the string in the text field to a function, and that works fine. However, I've also set the button's key equivalent to "return." The key command isn't being picked up, probably because the menu is not the "key" window. I know how to make a window th...

Setting Horizontal Line (NSBox) line width in Interface Builder

I have an application that I am building am making use of Horizontal Line (which is just a special case of NSBox). I've placed the component into the interface, but what to adjust the thickness of the line. NSBox has a setBorderWidth method, but doesn't seem to have this exposed when in Interface Builder. I would prefer not to do this ...

How to pass a value from Cocoa to an SQLite query

Hi, first of all please let me say that I am quite new to objective c development. I am writing a small app for personal use for the iphone, but I have some problems executing the following code: NSString *sql = [[NSString alloc] initWithFormat:@"select color_r, color_g, color_b from Calendar where ROWID = %@", [calendarsID objectForKe...

iphone Development - analyze error

NSString *temp = [self randomBallPick:temp]; the following error: Pass-by-value argument in message expression is undefined why? -(NSString*) randomBallPick:(NSString*) oneFilename { //create an array of filenames NSMutableArray *imageArray = [[NSMutableArray alloc] init]; for (int c=0;c<37;c++) { NSString *imag...

LSUIElement behaves inconsistently with activateIgnoringOtherApps

Specifically, it behaves inconsistently regarding text field focus. I have an LSUIElement popping up a status menu. Within that menu there is a view containing a text field. The text field needs to be selectable -- not necessarily selected by default, but whichever. When the status item is clicked, it triggers [NSApp activateIgnoringO...

how to use NSRunLoop in objective-C ?

Hi all, how to use how to use NSRunLoop in objective-C and wait for some variable to change value ? Thanks ...

Error while executing symbolicatecrash command "Can't exec "/usr/bin/xcode-select": No such file or directory at /usr/bin/symbolicatecrash"

Hi all, My application get crash in apple's testing phase. I have crash log. When I am execute symbolicatecrash command, I get an error Can't exec "/usr/bin/xcode-select": No such file or directory at /usr/bin/symbolicatecrash or some how command get executed then it shows same crash file. My .app & .dSYM files are in same directory....