objective-c

What's the difference between the method signature and the selector in Objective-C?

Until now, I believed that -(void)startToDoSomethingWithThis:(That*)thing andThat:(That*)otherThing has the following "method signature", which is at the same time also the selector: -startToDoSomethingWithThis:andThat: But now someone said that the selector is not like the method signature, and that the method signature also contains t...

Generating random names from plist

I'm wanting to read a list of forenames and surnames from a plist I have created, and then randomly select both a forename and a surname for a 'Person' class. The plist has this structure; Root (Dictionary) -> Names (Dictionary) --> Forenames (Array) ---> Item 0 (String) "Bob" ---> Item 1 (String) "Alan" ---> Item 2 (String) "John" -->...

OAuth Echo TwitPic — Working with a Twitter client on the iPhone

Hey everyone, I've been trying to get Twitpic to work successfully in uploading a picture through my iPhone app. This has worked fine in the past however now they've changed all their auth code. This is what I've got, and for some reason is just giving me a failure: oAuth = [[OAuth alloc] initWithConsumerKey:twitter_consumer_key andCon...

What exactly is super in Objective-C?

As far as I know, it's a pointer to the superclass. It's hard-wired with the superclass, and not dynamically figured out at runtime. Would like to know it more in detail... Anyone? ...

Custom Delegate Example in Objective-c

Hi, I understand using delegates in associated with other objects (i.e. UITextField etc.) But I am trying to find a simple example of setting up / using a custom delegate independently. Any help / pointers would be much appreciated. My understanding so far is: #import <Foundation/Foundation.h> @class TheBox; @protocol TheBoxDelegate ...

Is there a way to find out if iPhone obtained CLLocation by A-GPS, cell tower signal strength or wifi?

Hi, I'm trying to find a property that indicates how iPhone physically obtains CLLocation? As far as I am aware iPhone gets CLLocation via either: 1) GPS 2) Cell tower triangulation 3) Wifi ID and signal strength Can I programmatically refer to something in the publicly accessible libraries to get this? If there isn't a way to ident...

Overriding inherited types in Objective-C

This is probably a common Objective-C question reported by Java coders, but I don't know what to call it or how to search for the answer. Let's say I have a class and another class which extends it: AbstractModel @interface AbstractModel { } ModelImpl @interface ModelImpl : AbstractModel { } Separate from these, I have two more cl...

Passing an identical message to multiple ObjC classes

I have multiple classes, all of which I want to send an identical message to. To be clearer: I want to send doX:withClass: with the same parameters to a number of classes. Perhaps code would make it clearer: + (void)doX:(NSString *)blah { [Utility doX:blah withClass:[Foo class]]; [Utility doX:blah withClass:[Bar class]]; ...

Core Data Migration: Extracting fields to an abstract entity child

I have a migration where I'm moving fields from one entity into another entity which is a child of an abstract entity. My model has an entity, Thing, which is 1->M to an abstract entity, AbstractWidget, which is the parent for NewStuff. Something like this: +-------+ +----------------+ +----------+ | Thing |<--->>| AbstractWidge...

Managing calls to objects that get deallocated when the view is backed out of

I have a view controller managed in a UINavigationController. My view controller puts up a "loading" screen, and uses ASIHTTP to asynchronously load table data. Then it renders its table, and in each cell there's an image that it uses ASIHTTP to asynchronously load. When it lands each image, it uses [self.tableView reloadRowsAtIndexPaths...

NSURLRequest -> NSURLConnection

I was told that using the -> in that way will keep my UI ticking so it doesnt lock! and save doing NSThread / NSOperationQueue Can someone help me with the syntax of how i would use that? Im basically downloading a image into a UIImage*. Thanks ...

Bad Access Error in Cocos2D Game in SKD 4, but not 3

Yeah, so this one through me or a loop for a while until I figured out what was going on. With Apple releasing the final version of Xcode today, and iOS 4 coming out yesterday, I finally started to look into porting my apps to iOS 4. So I downloaded the new SDK, and got to work. After working on my app a bit, imagine my surprise when ...

Automatically capture the video with iPHone OS 3.x

Hi, I have just view the iPhone application Touch Cam (http://itunes.apple.com/us/app/touch-cam-video-recording/id337848815?mt=8) which provides the capturing video automatically. There is no api provided for this in iPHone OS 3.x. Is there any hidden API (Undocumented ) is available for this. or how can we start the capturing of vide...

Copy rows in NSTableView?

I can' copy selected rows from the table when app is running. Therefore, I try to implement my own method. I get all data into a NSArray and use writeToFile method It works but is very inefficient... Is there a better way to do this? Or there's a built-in method to do so? Such that when I push command-C, I can copy the value o...

How to declare a static integer in h class in iphone?

I am not able to declare a static integer in h class in iphone. static int i; this gives an error "expected specifier-qualifier list before static". please help me out.How to resolve this.How can i declare a static variable globally in iphone.Thanks. ...

GKSession sendDataToAllPeers:withDataMode:error: is asynchronous - how to get news of when it's done?

GKSession sendDataToAllPeers:withDataMode:error: is asynchronous ... or so I understand. Short of the peer sending an application-level ACK (which would be very clunky) is there a means of finding out when it's done sending? M. ...

Using TTPhotoViewController without the Three20's URL crap?

Whenever I add the TTPhotoViewController to my window , it appears without a top navigation bar and once I tap the image, the bottom navigation overlay and the status bar (the springboard one) will disappear permanently. How do I create a top navigation bar so I can add a button to hide the view after it was shown and how do I restore th...

Having Freudian child parent problems with my objects. Need some pointers and/or Reference?

Hey team, I think I have a basic question that is sort of hard to look up, I think. Objective-C for Iphone. I want to create two view controller instances that message and update an instance of a Model Class. How do you do this? I would prefer no using singletons. It's basically an "I really want to learn from you guys because this...

Syntax error before '^' token

I just upgraded core-plot to the latest version in an application that was already running successful plots. I followed the fairly simple instructions to the letter, however I'm getting 20 syntax errors in UIView.h. It seems that I'm not alone, but nobody has of yet posted a solution to the issue. An example: This code from UIView.h +...

is NSDateFormatter dateFromString: supposed to return nil for an invalid string?

According to the class reference, dateFromString method returns "A date representation of string interpreted using the receiver’s current settings". Using the following code: NSDateFormatter * formatter = [[[NSDateFormatter alloc] init] autorelease]; [formatter setLocale:[[[NSLocale alloc] initWithLocaleIdentifier:@"en_US"] autorelease]...