objective-c

How to get an iPhone address book contact's emails as NSStrings?

I know that there can be multiple values for an email, but I'm not sure how to browse through them. I can get a person correctly. ABRecordRef person = // getting a person; NSString* emails = (NSString *)ABRecordCopyValue(person, kABPersonEmailProperty); ... what's next? If I try to print the emails variable I get: Emails: <NSCFType...

Cocoa-Touch: UIImageView.image display vs UIImage drawInRect:. The former looks horrible compared to the latter when scaling images.

I have one app, a UIImage*. I'm painting the image twice: Once in a table cell, which I'm drawing manually for performance reasons, so it's getting pained with [image drawInRect:CGRect..]; The 2nd time it's in a UIImageView. The image is approx 3x the size of the rect I'm painting in. Both the UIImageView frame and the passed rect ar...

New NSMutableDictionary with value from other NSMutableDictionary

Hi, I have an NSMutableDictionary with the following values itemDictionary: { div = "Photo"; id = "http://www.myurl.com/images/photo.php?category=images"; summary = "Cool pictures"; title = "Photographs"; updated = Z; } What is the best way to Create a new dictionary with just the id value. I will be grateful for...

NSOperationQueue and concurrent vs non-concurrent

I want to setup a serialized task queue using NSOperationQueue but I'm a little confused by the terminology discussed in the documentation. In the context of an NSOperation object, the terms concurrent and non-concurrent do not necessarily refer to the side-by-side execution of threads. Instead, a non-concurrent operation i...

Can I make my iPhone app's content searchable via Spotlight?

On MacOS X, you can write a Spotlight Importer so that your documents and content can be indexed and searched with Spotlight. I would like to write an iPhone app that generates content that can be searched with iPhone 3.0's new Spotlight search feature. Is this possible, or is this only available on MacOS X? ...

Command /Developer/usr/bin/dsymutil failed with exit code 10

I am getting the above error message randomly (so far as I can tell) on iPhone projects. Occasionally it will go away upon either: Clean Restart XCode Reboot Reinstall XCode But sometimes it won't. When it won't the only solution I have found is to take all the source material, import it into a new project, and then redo all the co...

NSMutableString stringByReplacingOccurrencesOfString Warning

I've got an RSS parser method and I need to remove whitespace and other nonsense from my extracted html summary. I've got a NSMutableString type 'currentSummary'. When I call: currentSummary = [currentSummary stringByReplacingOccurrencesOfString:@"\n" withString:@""]; Xcode tells me "warning: assignment from distinct Objectiv...

Quick way to find what thread asserted in gdb?

When my Cocoa app hits an assertion in the code, gdb gives me a prompt as expected, but it's never (ok, rarely) in the right thread. I know I can use Xcode's GUI debugger and it makes it a little less painful, but I'm thinking there has to be a gdb command line trick I don't know. Is there an easier way of finding the thread that asse...

parsing JSON using objective C?

Hi everyone. I have spent 1 week studying objective C. Now I am quite confused at the dealing with data part. My friend gave me a link http://nrj.playsoft.fr/v3/getQuiz.php?udid=23423455&amp;app=2 and ask me write a class to parse this JSON. I had no clue what parsing JSON means. but I have gone online and looked up. I could understand a...

Is the Objective-C dictionary an ordered container?

as the title, when I insert element to a dictionary in objective-c (in order like: k1, k2, k3), is there any guarantee that when I enumerate it like: for ( k in dictionary ){ // output the k - value } it would show in the same order? ...

Overriding super class methods in Objective-C

If subclass in objective-c wants to override a super class's method, does it have to match the return type too? ...

Approaches to save some NSManagedObjects but not others?

Hi folks, I'm working on a Core Data iPhone app that pulls remote resources from the web into NSManagedObjects and saves them locally. I want the user to be able to designate which of these objects should be saved. This means that some will be saved, but many should be deleted. However, I might want to save and delete at different time...

subview outside parentview frame events

Hi, I'm adding programmatically an UIView B to another UIView A. The A frame is {{0, 372}, {320, 44}}. B UIView is add at {0, -74} and is {320, 74} wide. My problem is that B touch events are not handled. More precisely touch events are handled to a sibling UITableView of UIView A wich ends at {0, 372} even if B UIview is displayed ov...

Consuming .NET Web Service in Objective-C [iPhone]

Hi all, I am looking for some tutorials on how I can consume a .Net webservice on the iPhone platform (3.0). I have never looked at Cocoa XML prasing before, to the more indepth the tutorial is the better. We have an existing webservice framework currently in place, which return XML, so I would ideally like to consume these, as opposed...

Syntax to return an instance in Objective-C

Hi, can u please help me how to return an instance of a function which is inherited through interface in Objective-C Language? @protocol prot1 { public IDispManager getDispManager; } @end @interface A: NSObject (prot1) { } @end @implementation A { /** * Provides access to the disp manager. * @return Instance of th...

XCode 3.2 - can't create Objective-C class

My installation of XCode 3.2 has begun to exhibit some strange behaviour. When I try to add a basic Objective-C classs (inheriting from NSObject), in my iPhone project, I get the following popup: "Alert. Couldn't load the next page". The above-mentioned error happens at the point of trying to create the file (i.e. the creation process...

NSBitmapImageRep drawing in snow leopard

In MacOS 10.5 (Leopard) and 10.4 (Tiger) the following code was working fine: NSImage *pBitmapImage = [[NSImage alloc] initWithSize:[pThumbBmp size]]; [pBitmapImage addRepresentation:pThumbBmp]; NSSize pThumbSize =[pBitmapImage size]; if(pThumbBmp) { [pThumbBmp release]; pThumbBmp = NULL; } [pBitmapImage lockFocus]; [fillColor...

Objective-C - How to compare arrays and extract the difference?

Possible duplicate: comparing-two-arrays I have two NSArray and I'd like to create a new Array with objects from the second array but not included in the first array. Example: NSMutableArray *firstArray = [NSMutableArray arrayWithObjects:@"Bill", @"Ben", @"Chris", @"Melissa", nil]; NSMutableArray *secondArray = [NSMutableArray ar...

Suppressing Objective-C Warnings

Hi all, Is there any way to suppress Compiler warnings ?? Thanks ...

Exception: unrecognized selector ... when trying to push a view controller on Navigation stack

Hi, I am trying to push a view controller on the navigation stack with following code in my buttonPressed method -(IBAction) viewButtonPressed:(id)sender { PersonDetailViewController *personDetailViewController = [[PersonDetailViewController alloc] initWithNibName:@"PersonDetailViewController" bundle:nil]; [self.navigationController pu...