cocoa

objective c NSURL may not respond to +initFileURLWithPath

I have two lines of code in the applicationDidFinishLaunching function: NSString *targetFilePath = @"/Users/bob/Documents/About_Stacks.pdf"; NSURL *targetFileURL = [NSURL initFileURLWithPath:targetFilePath]; and I am getting the warning (title) in the second line... I have no idea what I am doing wrong. This is an absurdly simply app...

Remove only first instance of a character from a list of characters

Hi All, Here's what I want to do. I have 2 strings and I want to determine if one string is a permutation of another. I was thinking to simply remove the characters from string A from string B to determine if any characters are left. If no, then it passes. However, I need to make sure that only 1 instance of each letter is removed (no...

how to update UI controls in cocoa application from background thread

following is .m code: #import "ThreadLabAppDelegate.h" @interface ThreadLabAppDelegate() - (void)processStart; - (void)processCompleted; @end @implementation ThreadLabAppDelegate @synthesize isProcessStarted; - (void)awakeFromNib { //Set levelindicator's maximum value [levelIndicator setMaxValue:1000]; } - (void)dealloc {...

iPhone: fast hash function for storing web images (url) as files (hashed filenames)

What is a fast hash function available for the iPhone to hash web urls (images)? I'd like to store the cached web image as a file with a hash as the filename, because I suppose the raw web url could contain strange characters that could cause problems on the file system. The hash function doesn't need to be cryptographic, but it defi...

Difference between performSelectorInBackground and NSOperation Subclass

I have created one testing app for running deep counter loop. I run the loop fuction in background thread using performSelectorInBackground and also NSOperation subclass separately. I am also using performSelectorOnMainThread to notify main thread within backgroundthread method and [NSNotificationCenter defaultCenter] postNotificationN...

ffmpeg : How to set AVFormatContext from NSData.

Hi, I'm using FFmpeg library in Objective-C. I want to set AVFormatContext from NSData which contain imagedata. I know I can set AVFormatContext with av_open_input_file(). so writing contents of NSData to a temporary file, I can do it like this. [data writeToFile:@"./temp.mov" atomically:YES]; av_open_input_file( . . . NSFileManager...

While making an RSS reader which saves articles, how can I prevent duplicates?

Lets say I have a RSS feed which lists the 3 newest questions on SO. At 1 o'clock, the feed looks like this: While making an RSS reader which saves articles, how can I prevent duplicates? Convert char array to UNICODE in MFC C++ How to deploy a Java Swing application with an embedded JavaDB database? At 2 o'clock, this feed looks lik...

Predicate for comparing the month component of a Core Data date attribute

I have a Core Data entity which has a date attribute. I would like to write a predicate to extract all dates within a specific month, e.g. July, irrespective of year. How can this be achieved? Thanks ...

NSTimer as Alarm

Is the best practice of setting an alarm on OS X to create a NSTimer scheduled for the number of seconds between the current time and the desired time for the alarm, or is there an alternative to that method? ...

How to programmatically generate an audio podcast file with chapters and text track?

Hi Anybody know how to programmatically generate audio podcast files with bookmarks that can be used in iTunes / iPod / iPhone / iPod touch? Specifically text bookmarks (bookmarks with titles) that the listener can skip to a specific point in time in the audio file. Also how to add the text transcription of the podcast's content. Eve...

COCOA: Programatically creating new windows and accessing window objects

I'm having an issue with creating new windows in Cocoa. Hypothetically speaking, lets say I have "WindowA" and has a button called "myButton". When you click on "myButton", it runs this code in the following class file: -(void)openFile2:(id)sender { myNextWindow = [[TestWindowController alloc] initWithWindowNibName:@"MainMenu"]; ...

How to verify an XML digital signature in Cocoa?

I have a C# application that uses XML digital signatures to sign license files. I've used the standard Microsoft approach described here. I'm porting the application to the MAC and need to verify the signature. My general question is how best to do this? This is what I've done: I've used macport to install Aleksey's xmlsec1 library...

Creating a Multiwindowed Cocoa Program - Launching Procedure Suggestions?

I'm porting an application I developed in Visual Studio 2008 over to Cocoa. I'm currently doing a 'learn-as-you-go' approach to Cocoa, so I can experiment with different ideas and techniques in smaller, simpler projects and eventually combine them into one big application. My program logic is as follows (in a dumbed-down sense). Items...

How to update NSMutableDictionary. My code doesn't work.

I've populated an array using. arrSettings = [[NSMutableArray alloc] initWithContentsOfFile:[self settingsPath]]; The file is a plist with the root as an array and then a dictionary with three three keys defined as number. I've also tried setting the keys to string. I display the values in the plist file on a view using. diaper = [...

Can i get a notification, when a new day begins?

In Cocoa, is there a notification i can register for, that informs me, when a new day begins - at 00h:00min:01s in the morning? ...

Cocoa : Remove Item from NSArrayController

I have a NSArrayController bound to a NSTableView. With this I have the typical Add/Remove buttons. While Adding an item is very straight forward (I call a method, create an object with default values and add it) I have problems deleting objects from the controller. I know I can do this the easy way when connecting the button with the ...

Objective-C retain counts in dealloc

I'm seeing something fairly strange here, I've got breakpoints set in various dealloc methods in my app, and on inspection, the retain counts of the object self varies from 1 to 0. When dealloc is called, will the retain count of the object be set to 0 already? I'm using print (int) [self retainCount] in the console to test this. The 0...

Removing Objects From NSMutableArray

Hi, I have a NSMutableArray that contains all the calendars on my system (as CalCalendar objects): NSMutableArray *calendars = [[CalCalendarStore defaultCalendarStore] calendars]; I want to remove from calendars any CalCalendar objects whose title does not include the string @"work". I've tried this: for (CalCalendar *cal in calenda...

Passing An Array By Reference In Objective-C

I would like to pass a NSMutableArray by reference so that it can be altered by another method. What would be the correct syntax for this? Thanks, ...

NSTextField (Label) Attributed Text: Select

I have a NSTextField Label that has attributed text in it. The color and size are different from the defaults. (The text is a bit larger and green) Now, I need to be able to select the text in the label so as the click the hyperlinks embedded in the attributed text. This works fine; however, when selecting the text the format of the text...