cocoa

MPMoviePlayerViewController HTTP Authentication Header

I using the following basic commands to view a movie stored on a server in the movie player: MPMoviePlayerViewController *mMoviePlayer = [[MPMoviePlayerViewController alloc] initWithContentURL:getMovieURLRequest.URL]; [self presentModalViewController:mMoviePlayer animated:YES]; The problem is, I am getting a 401 authentication error w...

Cocoa Application Bootstrap Questions

I am an experienced developer, new to Mac development, so I Read a nice objective C guide Read the Apple memory management guide Went through the Apple intro to Cocoa Checked out the NSApplication and NSApplicationDelegate Refs Messed around a bit There are still lots of gaps, and I'm having a hard time finding good readables. Some ...

what is less resource intensive: Bindings, KVO, or Notifications

Rather than trying to run a bunch of tests. Does anybody know what is less resource intensive? Bindings, KVO, or Notifications? Has anyone tested to see as well? ...

Program overflows call stack by sheer force of will

Here's the call stack from a user's crash report: Thread 0 Crashed: Dispatch queue: com.apple.main-thread 0 com.growl.GrowlSafari 0x179d383c writeWithFormat + 25 1 com.growl.GrowlSafari 0x179d388e writeWithFormat + 107 2 com.growl.GrowlSafari 0x179d388e writeWithFormat + 107 3 com.growl.GrowlSafari...

How to remove square drawn around window resize handle in an NSScrollview?

I have an NSScrollview that takes up an entire window. The scrollview has a vertical scrollbar but no horizontal scrollbar. The window color is gray. The window is resizable. Cocoa automatically draws a white square with a light gray border around the window's resize handle (right below the bottom of the vertical scroller). I would li...

Match NSString with image file names in loop

I have the following method: -(UIImage *)flagFromOrigin:(NSString *)originString { NSRange range; for (NSString *arrayString in countryArray) { range = [[originString lowercaseString] rangeOfString:arrayString]; if (range.location != NSNotFound) { return [UIImage imageNamed:[NSStri...

Class 'TableDataSource' does not implement the 'NSTableViewDelegate' protocol

What methods should be implemented? I've tried to set the TableDataSource as a delegate to my TableView, but delegate methods wasn't called. After that I tried to set "TableDataSource" as delegate in code, and got this warning: warning: class 'TableDataSource' does not implement the 'NSTableViewDelegate' protocol Delegate metho...

Cocoa Document-Based App: Change "Save" to "Save As" for Viewer-Only Filetypes

I have a Cocoa document-based app that (currently at least) functions as a basic text editor. It saves .txt, .rtf, and .rtfd, and loads those plus .doc and .docx. If I open a .doc or .docx file and edit it, then try to close, it reminds me to save, but the save option doesn't do anything since the application is only a viewer for those...

64-bit Preference Pane Displays Window

I've developed a preference pane which initially was being built with the Architectures build setting set to "32-bit Universal" (was the default). This caused System Preferences to relaunch in 32-bit mode but the preference pane worked fine. I switched Architectures to "Standard (32/64-bit Universal)" and set garbage collection to "Sup...

Is it possible to enforce shared-nothing multithreading at the level of the OS or programming language? (OSX, Objective-C)

I'm trying to implement an actor model of concurrency in Objective-C, because I want to avoid the infamous problems of shared mutable state, locks, semaphores, etc. It can be done, but it takes real discipline to avoid accidentally using shared state. One way to enforce the shared-nothing rule is to use separate processes instead of se...

NSPredicate: Search on NSNumber (Cocoa)

Hi all, I have an Cocoa Core-Date Application. I added a search field and bound it. Now, I have tried to add some predicates but failed! Here are my two questions: First, the predicate should filter NSNumbers but I cannot build a working predicate. My try: keyPath == [NSNumber numberWithInteger:[$value integerValue]] (keyPath repre...

Binding two columns of the same table to two different NSArrayController gives strange results.

Hi, I'm trying to understand cocoa bindings, but I found a problem that I'm really not able to understand. I've got a really simple application in which you have a table with two columns and I want to bind this two columns to myController object that has two NSArray of literal string objects. So I created two NSArrayController and boun...

How to create NSButton with delayed NSMenu ?

Hi, In Cocoa i want to create an nsbutton with delayed menu. i.e., When clicked it should call the action method and when kept in pressed state for 2 seconds it should display a nsmenu. It is similar to "Build Active Target" button present in Xcode toolbar. Regards, Dhanaraj. ...

How to find Bundle Identifier from known PID?

I have the pid (process identifier) of an arbitrary running process. How can I find the bundle identifier (if any) of the associated application? ...

Why doesn't this NSPredicate work?

Hey, I have an Array of MKAnnotation objects called arrAnnotations. I want to pick out one of the annotations with the same coordinate as the one stored in a CLLocation object called "newLocation". I'm trying to use an NSPredicate, but it doesn't work. NSPredicate *predicate = [NSPredicate predicateWithFormat:@"(SELF.coordinate == %f)...

Reasons for an iOS thread to exit prematurely?

I have a block of code in my iOS app that fills an array with Core Data objects on a background thread, via NSOperationQueue, then notifies the UI on the main thread when it completes. Everything has worked perfectly in iOS3. However, in my new iOS4 build, I started noticing an occasional bug where the UI never gets notified that the da...

NSTimer: Getting firing to NOT act retroactively.

Hello Everyone, I'm currently using the snippet of code presented below to fire some methods every second. My app is running in the background. The problem is that if the computer wakes up after a sleep period the timer wants to retroactively fire all the methods it has missed. Similar issues come up if the user were to change the Syste...

Internal and External IP Address in 10.4

IMPORTANT EDIT It seems I've caused a lot of confusion in this post by differentiating between 'internal' and 'external' IP addresses. Allow me to try to clarify: Internal = PRIVATE IP ADDRESS External = PUBLIC IP ADDRESS The concept of internal and external were completely of my own invention. Apologies. Hey Everyone, With your he...

super viewDidUnload in Cocoa

In the function viewDidUnload it is initially empty. However, I'm following a tutorial where at the end of the function they write [super viewDidUnload]. I noticed that in the dealloc function, [super dealloc] is automatically written at the end. Why isn't it automatically written at the end of viewDidUnload? Does it make a difference? W...

An Important Question about NSString

The problem is after i press 2 buttons the App crashes and I can't figure out why Button1 is wired to button1 Button2 is wired to button2 ... Button5 is wired to button5 What am I doing wrong? Basically I want to check if the sequence of #'s is punched in correctly (55235) In my AppDelegate.H file, I've defined a variable called NSS...