cocoa

main.m error in iPhone build

Never thought I'd get an error in this file when I compiled, but after running my app in debug mode, The app stops and highlights the line NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; in my main.m file as a breakpoint. When I run in normal mode, the app just shows a black screen. What does this mean? (Update) Okay,...

Running subprocess.call to run a Cocoa command-line application

I have one piece of Cocoa code I wrote that takes in an XML file containing bounding boxes that are then drawn on top of a video (each box has an associated frame). The Cocoa program is meant to be run from the command line (and takes in all its parameters as command line arguments) I can run program just fine with any XML document. How...

How to gradually retrieve data from NSTask?

I am working on a GUI (Cocoa) for a command-line tool to make it more accessible to people. Despite it being a GUI, I would like to display the output to an NSTextView. The problem is that the output is large and the analysis the tool carries out can take hours/days. Normally, when working with NSTask and NSPipe, the output is displayed...

how to access an NSDictionary through an ordered NSArray

So I have an NSDictionary that contains several objects with properties (key:values), but the issue is that I need them in a specific order. Stored as an NSArray is a list of objects that I would like to use as keys for the NSDictionary. I can output the NSArray and NSDictionary to the Console, however when I to access each of the valu...

TDD for an OSX app

Are there any good solutions out there for TDD of a MacOSX Objective-c app? EDIT: more info I would really like something similar to rSpec from the Ruby world. Is the XCode built in stuff sufficient? I have heard that it is not. I would like something that supports Mocks, Stubs, and most/all of the test conditions supplied by rSpec (or...

Store Admin Password in OSX Keychain For Automating Certain Processes?

I have a whole series of commands that I need to run on login, many of which require root privileges. So, to save a few steps I put them all into one apple script so I wouldn't have to open the terminal. But still, I'd like to be able to do this without entering my password at all (I like to boot my machine early AM while I'm still sle...

Ruby on Rails and Cocoa

Hey guys, I am building an application in Cocoa that uses a local Ruby on Rails web server to communicate data and info between the client and server. There are times in the program where I need to poll the web server for some information using HTTP GET requests, but I'm not sure if that is the best approach. Are there any alternatives ...

Converting an NSComboBox to and NSTextField Easily

I have an NSComboBox and I was wondering if there is an easy way to convert it to an ordinary NSTextField? Considering NSCombBox is a subclass of NSTextField, I would think there is an easy way to turn this on/off but I can't figure it out. ...

how to display pictures as thumbnails in a view

Hi I am trying to get a view with multiple pictures as thumbnails; but i am not really savy about how to obtain this. can anyone tell me how can i create a thumbnail view from files in a folder and show it like in a tableview (or whatever is the name of the container). I wanna show all the pictures thou, not just one, so i cannot use ...

Cocoa bindings to display NSDictionary keys in NSTableView

I currently have a NSArrayController whose content property is (programmatically) set to an NSMutableDictionary and my UI has a single NSTableView. The information that the NSMutableDictionary contains is not set via the UI. How would I use Cocoa bindings to display the dictionary keys in NSTableView? I already know how to use the Dat...

NSDateFormatter, NSDate, UTC and strange date format

I have a very strange date format coming to me via JSON. e.g. - "July, 18 2010 02:22:09" These dates are always UTC. I'm parsing the date with NSDateFormatter, and setting the timeZone to UTC... NSDateFormatter *inputFormatter = [[NSDateFormatter alloc] init]; [inputFormatter setTimeZone:[NSTimeZone timeZoneWithAbbreviation:@"UTC"]]; ...

Exception in mouseDown method

Hi all, I am doing drag and drop with NSView. In the object to be dragged, which is subclass of NSView, I implemented mouseDown: method as follows: @try { NSPoint location; NSSize size ; NSPasteboard *pb = [NSPasteboard pasteboardWithName:@"CameraIconContainer"]; location.x = ([self bounds].size.width - size.width)/...

Getting into pixel data of NSImage

Hi, I'm writing application that operates on black&white images. I'm doing it by passing a NSImage object into my method and then making NSBitmapImageRep from NSImage. All works but quite slow. Here's my code: - (NSImage *)skeletonization: (NSImage *)image { int x = 0, y = 0; NSUInteger pixelVariable = 0; NSBitmapImageRep *bitm...

NumberPad restrict numeric input

Hi, I have some simple UITextFields that bring up the Numberpad. I would like to restrict the control the user has over input. For example, one particular textField should not been allowed any value over 32. Which parameter do I use with <32 to enable this? Thanks ...

UIView and orientation changes: UITextField Preservation and UI frame custom animations

With no developer interaction you can have a view resize itself to support an orientation, in many cases this is fine, but what if you need to change the layout of your UI objects to better suit the new orientation? Apples answer is to: Have two separate ViewControllers with xibs that reflect the desired layout. Designate a master V...

How to get the Battery Charge Level specifically in mWh (not percentage) for Mac (Cocoa or C)

Hello Everyone, The title pretty much explains it all. I'm creating a mac app and I need the battery charge level specifically in mWh (not percentage). Would like to do it in C or Objective C preferably. Thanks! ...

Exist another kind of "Application architecture" available?

I only found "Document-Based Application Architecture" in Cocoa. Is there another kind of "Application architecture" available? ...

NSPredicate to filter array of words to array of letters

I am trying to make "weighted" list of letters as words are created. I have a massive list of words in an NSArray. For example I am trying to acquire a new NSArray filled with just the 3rd letters of all the words based off the first two letters entered. So far I have... NSArray *filteredArray; if (currentWordSize == 0) { filteredA...

Crash (SIGSEGV) in Core Data internal methods

Hi, I got a crash report and the crashing thread's call stack all show Apple's code. From the looks of it, Core Data's undo manager is accessing an invalid pointer in -[NSManagedObject(_NSInternalMethods) _newSnapshotForUndo__] + 356. I've googled the point of crash and the only other similar crash log I found was from Sequel Pro cras...

Create UIColor from NSColor Data

I have a CoreData Mac app for which I'm writing an iOS front end. All's working well thusfar, I'm able to successfully read files created with the Mac app in the iOS version. I'm struggling with how to read the NSColor data (being stored as an NSData object in my data model) into a UIColor in iOS version of the app. To summarize: How ...