cocoa

Launch an app that doesn't have main window in Mac OS X.

As explained at this site, I could launch an app from Safari. I need to open an app that does some work behind the curtain, so I want an app that doesn't have a main window. Q : How can I make an app that doesn't have a main window or that doesn't show any window? ...

Launching App using 'launchedTaskWithLaunchPath' Cocoa/objecive-c API.

I need to launch 'TextMate' from an App, and I used the following code. [NSTask launchedTaskWithLaunchPath:@"/Applications/TextMate.app" arguments:[NSArray arrayWithObjects:@"hello.txt", nil]]; But, I got the following error return. *** NSTask: Task create for path '/Applications/TextMate.app' failed: 22, "Invalid argument". Termin...

Mac sample code using USB and CFRunLoopSource

I'm trying to (re-)write a program that uses USB controlled scanners. I've got my USBIOInterfaceInterface set up, so I can send and receive messages over the pipes. I am successfully calling WritePipeTO and ReadPipeTO synchronously but I want to read from the scanner asynchronously. I've tried using ReadPipeAsyncTO, but the callback nev...

NSTokenFieldCell Subclass to force use of Core Data To-Many Relationship

I have come across an interesting conundrum (of course, I could just being doing something horribly wrong). I would like an NSTokenField to "represent" a relationship in a Core Data Application. The premise is such: You click on a Note from a TableView (loaded from the Notes Array Controller). The token field is then bound (through "val...

Comparing different 'the launching Cocoa app with parameters' methods.

I found there are at least three ways to launch an app with Mac OS X from an application. NSTask. I can give parameters, but it seems that it's not for an Cocoa App, but an UNIX style binary. system function (system()) just the same way as C does. I don't know the reason why but it seems that nobody recommends this method. NSWorkspace...

What's the best way to move from developing Cocoa apps to Cocoa games?

I've created several Cocoa applications now, but I'm unsure of basic concepts of game development. I've written apps using very few custom interface elements and only very simple graphics work, and I'm looking to write a pretty basic 2D game to get started (but in realtime, not checkers or something (which I think I could handle already ...

How to implement the folder tree in the left of finder?

I just like to implement a function : Develope a app , and have a outline view, which have a folder and file tree just like Finder or a app called PathFinder , how to implement it ? Thank you very much! ...

Adding NSMutableArray to NSMutableDictionary and the arrays are null?

I've got a simple object "post" that has two NSMutableArrays as properties. One is for "image" objects and the other is for "video" objects. At some point in the lifecycle of "post", I ask it for a dictionary representation of itself. NSMutableDictionary *postDict = [post getDictionary]; -(NSMutableDictionary *)getDictionary{ NS...

How to implement play or pause a flash?

I used a webkit to show a flash , but now I want to add a play button and control the flash , How to do ? thank you very much! ...

How to use NSWorkspace launchApplicationAtURL?

I tried to run equivalent of "TextMate foo.txt" using launchApplicationAtURL. The name of binary is "TextMate", and I have one parameter. I tried the following code, but it doesn't seem to work. // find the textmate NSURL * bURL = [[NSWorkspace sharedWorkspace] URLForApplicationWithBundleIdentifier:@"com.macromates.textmate"]; NSWork...

How do I find working examples of Cocoa/Carbon API?

I find it hard to find some working examples of Cocoa/Carbon framework functions, whereas there are well documented function prototypes from Apple. For example, LSOpenItemsWithRole function has well defined prototype, but I guess some examples would be a great help for a mac programming beginners like me. How can I find some working ...

Cocoa - Force Quit all other applications

Is there a way to force quit all other applications from a cocoa app? If it kills the app itself if doesn't matter It supposed to quit too. It has to be force quit since i dont want any dialogue boxes about saving or anything poping up. Thanks! and cocoa as in desktop osx. NOT iPhone. ...

mouseDown: event not recognized in NSImageView over subclass of NSView

Hi all, I am trying a simple drag and drop application. I have created a subview of NSView named: CameraIcon, which has an image view and certain text fields over it. In its mouseDown: method, I am initiating drag operation, I have also given a NSLog in it, so that I can notice in debugger when it is clicked. Problem is: when I ...

Cocoa and REST: Should API details go in the model or in an API class?

I have a RESTful server and need to create the client in a Cocoa app. I have a model called Resource. When I GET /resources, my server returns all resources in JSON. I have a model called Client that owns many resources. The Client has an instance method -(NSMutableArray*)resources An NSArrayController manages the resources. The firs...

Recommended document structure. File Wrappers? Roll my own?

Hi, I'm currently working out the best structure for a document I'm trying to create. The document is basically a core data document that uses sqlite as its store, but uses the Apple provided NSPersistentDocument+FileWrapperSupport to enable file wrapper support. The document makes heavy use of media, such as images, videos, audio files...

Getting CFMutableDictionaryRef Values

Hello Everyone, I would like to access some values from a CFMutableDictionaryRef and then do some math on them. Using the code below I have managed to print some properties of my battery. I am also able to print out single values (although in doing so I get a warning:invalid receiver type:CFMutableDictionaryRef). Then I try to convert...

How to get a list of all running processes on a Mac?

It would all be good to get: The process ID of each one How much CPU time gets used by the process and can we do this for Mac in C or Objective C? Some example code would be awesome! ...

Converting signal to NSException only work the first time

It seems that when BSD signals are converted to thrown exceptions, it only work the first time but not subsequent times. I tried to convert signals to exception via the following call I made in the main method just before calling NSApplicationMain : [[NSExceptionHandler defaultExceptionHandler] setExceptionHandlingMask:NSHandleUncaught...

What are some methodologies that a solo developer should use while creating cocoa programs?

Hello, I have recently started learning cocoa development with a fairly large scale(probably Core Data based) application in mind as my goal. I have been looking into development methodologies that would be used to help build a higher quality product with better code and although I have found a couple that I am sure I would like to use,...

Why is raising an NSException not bringing down my application?

The Problem I'm writing a Cocoa application and I want to raise exceptions that will crash the application noisily. I have the following lines in my application delegate: [NSException raise:NSInternalInconsistencyException format:@"This should crash the application."]; abort(); The problem is, they don't bring down the application -...