cocoa

How can I make sure NSOperations execute in a failsafe way?

What I Want I've got an NSOperationQueue in my application and it's critical that all operations get processed before the application quits. I've got the following code on quit to make sure the NSOperationQueue is empty before quitting: if ([NSThread isMainThread]) { while ([[operationQueue operations] count] > 0) { [[NSRun...

Get NSTableView to register drop from PNG source

Trying to get this to work, and not sure what I'm missing. The idea is to drop images on a NSTableView so that I can grab their paths and do some manipulations for them. I can get the drop to work for NSPastebouardTypeString, but I cannot for the life of me get it to register dragging PNGs from Finder into the tableview. What am I missin...

Program causes OSX (Snow Leopard 10.6.4) window server to spontaneously crash.

I have a program that uses OpenGL combined with Cocoa and Python using PyObjC. I've recently expanded on my menu making code to show menu selections for maps including map information. When using the new code, the window server will spontaneously crash at some random point (Not random but it appears that way). The new code uses nothing ...

What is an inverse relationship in CoreData

Hi, I am using CoreData but I don't think I got the inverse relationship concept right. Could any one explain what is it? Let's say I have a "File" entity with "files" relationship and "parentFile" relationship "File" entity has: a to-many relationship "files" with itself ("File"). a to-one relationship "parentFile" with itself ("Fil...

How to implement custom NSApplication terminate: behavior in Cocoa?

I'm attempting to implement custom termination behavior in a Cocoa application. Normally when my application exits gracefully, it performs final-runtime database cleanup and then exits. This occurs inside AppDelegate (delegate of NSApplication) whenever [NSApp terminate:aSender] is called: - (NSApplicationTerminateReply)applicationShoul...

my mutablearray doesn't work

hello guys sorry for my stupid question (beginner) I got the demo program Accelerometergraph the apple site and would like to use mutablearray in the values of acceleration x. but my mutablearray contains only one object, there being several passage mutablearray routine and should contain the same number of objects that the counter show,...

NSPredicate string matching against NSSet's

I'm trying to use an NSPredicate to search for string matches against an array of CoreData objects generated like so: // Grab an array of all Company projects NSArray *array = [[company projects] allObjects]; I use the following predicate to match any project names, company names or client names with a case-insensitive string (note: t...

Switch between NSView

Hi there. I have an NSView with two views inside of it. I am trying to hide one view and show the other one, but the view won't change. I tried with setHidden, removeFromSuperview, addSubview in front, everything. The first view is still there and the other one will not show itself. I am doing something wrong? Thank you, —Albé ...

Coredata: Strategy Pattern Implementation

I'm trying to implement the Strategy pattern using Core Data and Objective C. To simplify, I have, say, a multilingual Text entity, which has several attributes, such as a Date for last saved, and a NSSString for author etc etc. I want to add a reference to a Language entity, which could be one of several subclasses, such as French, Ita...

NSTableView double-clicking/renaming

By default, double-clicking triggers renaming in NSTableView. How can I let double-clicking instead trigger my own custom code (such as opening the double-clicked file)? And also: How can I let the renaming be like in Finder, where you first single click, and then click again and quickly move the mouse pointer away? That is how renamin...

Cocoa SBridge : how to get the return value (complex type) of applescript

Hello, I'm trying since one month to create an application that detects the current track of iTunes to tag the song and calculate the bpm (through a taping button) When the user modifies one of the field of the tag, the track is locked in the application : that means : if iTunes currentTrack changes, my application stay on the previous...

How to diagnose a KERN_PROTECTION_FAILURE

I am getting an interesting crash that I can never seem to replicate on the simulator: Exception Type: EXC_BAD_ACCESS (SIGBUS) Exception Codes: KERN_PROTECTION_FAILURE at 0x00000008 Crashed Thread: 0 Thread 0 Crashed: 0 libobjc.A.dylib 0x3212e86c 0x3212c000 + 10348 1 StockTwits 0x00016b06 0x10...

Simple Question: Cocoa Unit Tests and MVC

I am new to unit testing, I understand the basic concepts, and I am able to get unit testing setup correctly in my Cocoa projects; however the thing that is giving me a hard time is what exactly I should be writing unit tests for. For example, I know that you should write tests for model objects, but is that all I should be writing tests...

send the user input to url and fetch the result and display it in the program in cocoa objective c

hi, I am writing a program that would allow for online currency exchange on a MAC, I wanted to use the information on www.xe.com . I was wondering if A) if it would be possible for me to do that. and if yes the B) if it would be possible for the program to send the user input to the website and then fetch the result and display it in ...

How to fill the right bottom corner of NSScrollView?

I want to change its color, but I'm not sure wether to subclass NSScrollView or NSClipView. Or if the corner can be inserted as a regular NSView. I don't need code. Just a hint at how to do it. ...

The bundle is damaged or missing necessary resources.

I simply general a Interface Builder plug-in project called "Test", and then build directly, successed. But I can't double click the .ibplugin file to install into real interface builder. I googled a lot, some people said I need to put .h & .m file into TestFramework Target, and I did, some one also said, I need to change install direct...

i am getting warning: incompatible Objective-C types assigning 'struct NSString *', expected 'struct NSMutableString *'

i am getting warning: incompatible Objective-C types assigning 'struct NSString *', expected 'struct NSMutableString *' on this line:- Value = [Value stringByAppendingString:str]; I declared Value as NSMutableString* Value; How to rectify this? ...

Is there anything like SHA1CryptoServiceProvider (Which is C#) in Objective-C?

I am trying to create a serial number checker in an app that I am writing, and it uses cryptography to encode the name and entered number against what it actually should be. I am familiar with the SHA1CryptoServiceProvider used in C#, but is there anything like this in Objective-C? Here is sample code from C# that I want to convert to...

Attempting to Apply NSMutableParagraphStyle to new NSRange Failing

All, I'm tweaking an NSTextView to basically support insertion of boiler plate text and indenting. I'm running into a problem where the indenting of boiler plate text is applied to non-boiler plate text after I remove the boiler plate indenting style from the edited range (i remove the style when the user hits enter). Here's where thi...

Printing a specific NSRect from an NSView subclass

I'm working on trying to get my NSView subclass to print nicely, but I'm having trouble figuring out custom pagination. My problem is this: only a portion of my NSView subclass contains data worth printing, so I've written a function - (NSRect)printableBounds to get the rect within the NSView that I want to print. I want to print only th...