cocoa

How to show a NSPanel as a sheet

I'm trying to show a NSPanel as a sheet. I'm naively doing something along those lines: SheetController *sheetController = [[[SheetController alloc] initWithWindowNibName:@"Sheet"] autorelease]; [[NSApplication sharedApplication] beginSheet:sheetController.window mo...

NSTask returning HTTP Headers

I'm running /usr/bin/perl or /usr/bin/php via an NSTask and want to retrieve the HTTP headers of the program. I've properly formatted the environment (Perl requires env vars to be prefixed with HTTP_), but neither of the task are returning anything other than raw output. I've been through the documentation on NSTask and the man pages f...

Retrieving All Of An NSTreeController's Objects.

Bit of Background info, I'm using An NSOutlineView with Core Data. This Is What I'm trying to do: Retrieve All The objects from the Outline Views Tree Controller. Retrieve the 'name' Property (Core Data) from each of these objects as a String. Finally store the Strings of the 'name' Property from all the Objects in an NSArray. For ex...

How to change suffix: bundle into webplugin in the folder Products with Xcode Project?

I wang to develop a plugin with safari, now I new a Project with bundle . then I know that if the plugin work , the app.webplugin will be put into the folder:/Library/internet plugins. But when I rename the suffix of app.bundle in the Products folder of project tree into app.webplugin , then when I rebuild , I find that in debug folder t...

Checking for a valid delegate object before sending it a message.

I am trying to implement the delegate Pattern in Objective-C, however I am experiencing a Bad Access exception when invoking the delegate sometimes. It seems this is caused by the delegate being released. Apple does not recommend to retain delegates. How can I check my delegate if is still valid before trying to send it a message? ...

Application that runs in background and bugs the user.. (on users request)

I need to launch a program that will at a users pre defined interval, open and bring to front a (preferrably very good looking) style window to ask the user to fill in some details. I have written some normal cocoa apps, but this seems to require some extra knowledge I dont have (: Where do I start? (And before anyone gets upset i might...

Getting array elements with valueForKeyPath

Is there any way to access an NSArray element with valueForKeyPath? Google's reverse geocoder service, for example, returns a very complex data structure. If I want to get the city, right now I have to break it into two calls, like this: NSDictionary *address = [NSString stringWithString:[[[dictionary objectForKey:@"Placemark"] object...

How to determine the order of substrings in an NSString?

Hi, I wanted to know if there is any (easy) method to find the order of a given array of substrings in an NSString? I have a large block of text and a few substrings. I'm only interested in the order that the substrings first appear in the text. So if the text was "can you tell me you are working late if you can" and the substrings w...

How careful are you with your return types in Objective-C?

Say you have a method that returns a newly generated NSArray instance that is built internally with an NSMutableArray. Do you always do something like this: - (NSArray *)someArray { NSMutableArray *mutableArray = [[NSMutableArray new] autorelease]; // do stuff... return [NSArray arrayWithArray:mutableArray]; // .. or [[muta...

What are the most valuable parts of Computer Science studies for Cocoa developers?

What are the most valuable parts of Computer Science studies for Cocoa developers? Another way I might word this question is: If I’m not going to go to school for Computer Science but want to be a developer working primarily with Cocoa, what are the things I should make sure I learn that I otherwise might miss by being self-taught, an...

Objective-C syntax checker

Is there an Objective-C syntax checker? I have tried gcc -fsyntax-only but it is not really 'syntax only'. It still produces errors if run on an individual implementation file which has references to external frameworks. I am looking for something that can perform a syntax check on individual header or implementation files without att...

How to debug the main SafariPlugIn project ?

Ok, Now I want to add a menu in the safari menubar. I Create a Cocoa bundle project in Xcode .and then change the target extension is "webplugin" .and then add WebPluginMIMETypesFilename com.example.webplugin.plist to the info.plist.but I don't know the is right?. I make the prinpical class is my main plugin class SafariPlug . and then ...

Securing xml plists in Cocoa / Objective C

I am writing an application which reads information from am xml plist in the bundle upon startup. The information in the plist has been compiled through many days of work and I would like to ensure that it cannot be extracted easily from the app bundle by another party after distribution. Is there any way to secure or encrypt xml plists...

Array of directories names as data source for NSComboBox

Hi, I have some problems to retreive folder names and send them as items for a ComboBox My actual code: NSError *errors = nil; NSString *pathForDirectory = @"/Folder/Folder/"; NSFileManager* fileManager = [NSFileManager defaultManager]; NSArray *contentsDirectory = [fileManager contentsOfDirectoryAtPath: p...

Reading data from a file

Hi, I'm new to mac and Cocoa so I'm sorry if this is a stupid question.. I need to read all the lines I wrote on a file I saved on my desktop. The file format is .txt; I tried with stringWithContentsOfFile but the program freezes. I tried with GDB and I noticed that, while the path is correct, the string which is supposed to contain the...

Cocoa Check for Updates

What is the best way to add a "Check for updates..." functionality to a Cocoa application? I saw a little framework implementing this but I'm not sure that's the better way. Should I implement it from scratch? ...

Adding CalTasks from an NSArray.

I have an NSArray of Strings and what I want to do is create a new CalTask (for the calendar store) for every String, I want the Name of the task to be the string that is being added, the Priority and Due Date to be set in the code. For example I have an array with the Strings To-Do 1, TD 2, TD 3. So I want to create 3 CalTasks, the fir...

Cocoa menu with images

I need to make a popup or pull down menu in Cocoa that will contain either an image or an image with text as the representation of the item. Can anyone suggest a way I could do this programatically? ...

Keep a reference to a file after it has moved in objective-c?

I have a Cocoa application that stores a reference to multimedia files (images, videos, etc) on the user's computer. I'm wondering if there is a way to get a reference to that file other that using a file path so that if the user moves that file to a different folder on their computer, I would still know where it is. I'm currently stor...

Terminating Another App Running - Cocoa

Hey all, How can I terminate another app that is running in cooca. Let's say I have iTunes running, and I type in quit in my app, it would quit itunes. "iTunes" is just an example, it could be anything the user wants. I can open any app from my application, but I want to know how to close any app running. thanks kevin ...