objective-c

How to use typedef in dynamic properties?

It's the first time I'm trying to use typedef. Admittedly I don't have a very clear idea of what's going on but my understanding was that the values inside typedef get assigned integers starting with 0. I've tried to use them as integers but I get various warnings and errors. One of them is "[NSCFNumber objectForKey:]: unrecognized selec...

Xcode google map navigation

I currently have an application which will drop pins onto various points of interest on a map, all done programmatically on the iPhone. What I am aiming to get done now is to allow a user to navigate to that location and get turn by turn directions by calling up the built in navigation tools on the iPhone. Is there anyway that I can do...

XML Schema Binding / Object Model Framework in Cocoa

New to XSD here. Has anyone found or written a framework for working with XML schema object model in Cocoa/Obj-C? What I really need is the ability to define permitted types of modifications to an NSXMLDocument, as described in an XSD File. This includes defining sequences of child elements, list of attributes and their permitted valu...

Question about naming conventions for Cocoa/Objective-C for iPhone (with respect to release and autorelease)

Can you describe the naming convention difference between a method that returns an object it has allocated for the caller (and that the caller should release), and a method that returns an autorelease object? ...

Help Troubleshooting NSZombie Error Message

Hi all, I have a modal view controller which is crashing when it dismisses itself. The error is EXC_BAD_ACCESS (yipee). I am tryin got use NSZombie to work out the problem. I get am getting the following : 2010-10-20 17:15:58.936 [24058:207] AddRunningClient starting device on non-zero client count 2010-10-20 17:16:06.846 [24058:207] *...

iPhone Question about properties

If you declare a property with a retain attribute, do you need to release the property before you set it to nil? What does the @synthesize directive do? ...

SQLite + memory management issues

I have a SQLite database containing image data as a BLOB, and I am using the follow code to set the properties of an object, but I am getting major memory issues with the data, particularly on the data and w.wineImage objects, even though it looks like I am releasing everything correctly... if(sqlite3_prepare_v2(database, sql, -1, &sele...

NSTableView Issues...

I'm trying to follow this tutorial on binding: http://andrehoffmann.wordpress.com/2009/09/03/phonebook-tutorial-for-dummiesxcode-3-1-3/ but the app keeps crashing at run time. In IB I have a NSBUtton, NSTableView, NSArrayController and a NSOBject (named AppController) The tableview has 3 cols. Ad Name, Col and Height. In AppContro...

Can someone please explain CMTime for iOS4?

I would like to use AVPlayer Class' seekToTime. It takes a CMTime. I read the CMTime reference from Apple but its is very hard to understand. Can someone please give me an example on how to use... - (void)seekToTime:(CMTime)time ...

How to get the sender's name of an NSButton

I have several NSButtons that are attached to a single IBAction. I need to differentiate inside the method between the different buttons. I tried the following, but it doesn't work: for (int i = 0; i++; i < 7) { if (sender == [NSString stringWithFormat:@"button%i", i+1]) { NSLog(@"sender is button %i", i+1); } } H...

Rounding NSDecimalNumber

I'm having the hardest time figuring out something that seems like it should be very simple. I need to accurately round an NSDecimalNumber to a particular number of decimal places (determined at runtime.) So far as I can tell, I have two options, neither of which I like. Convert to a float, and use C rounding functions: I don't like th...

Calling a method back on the parent controller without a warning message

I have a front-view and a flip-view much like the utility weather-app. To avoid dealing with the complexities of protocols... on my flipView I need to call some code that resides back on my front-view. This works... but generates a warning during compile. [self.parentViewController returningFromGetStringView]; Warnings (shows twice)...

What is a Protocol

I've read the documentation but I'm still confused. Can someone please explain what a protocol is? (You could give code examples but I'm really looking for an explanation) ...

Accessing a class' instance variable (NSMutable Array) from another class

Hi all - new to Obj C and programming in general - learned a lot from this site and really appreciate everyone's contributions. My scenario is as follows (programming an iPhone game which explains the funny names) In my main gameLoop (which is in my view controller) if a certain condition is met I create an enemy - the cherry bomb if ...

How to change the value of an NSMutableArray at a particular index

[array objectAtIndex:i] doesn't work as an L value, so it can't be used to set the object at index i. ...

Code is extremely leaky.. I need help Identifying where the leaks are coming from.

My code works fine on my ipod, it's not slow and doesn't crash, but using Instruments I discovered 826 leaked blocks. The Header file is: #import "CountySelectionViewController.h" #import "iProspectLiteAnnotation.h" #import "iProspectLiteAnnotationView.h" #import <CoreLocation/CoreLocation.h> #import <iAd/iAd.h> #import <sqlite3.h> #imp...

What is the convention used when abstracting iPhone/iPad code into a Universal Binary?

So I am currently working on a universal binary for an app that is to be ran on iPad and iPhone. The differences are basically only UI changes. So, with that in mind, I have a class called ConfigurationController that is of type UIViewController. I then sub class ConfigurationController into iPadConfigurationController and iPhoneConfigu...

AVAudioSession not working as described by Apple

Hello. My game has 3 background songs. I would like the game to set the background music to off when there is ipod music playing, else it will play the last played piece of music. When the muser changes the music with the ipod music on, the ipod music should go away and the background music plays. The problem is, the second time I try t...

Objective-C array of floats misbehaving (EXC_BAD_ACCESS)

I'm declaring an array of primitives on one of my objects, and cannot seem to access it from the outside. I'm fairly new at ObjectiveC, is there some obvious mistake I'm making? header file: @interface MyObject : NSObject { //@public <-- this shouldn't be necessary, right? I have accessors! float *d; } @property float *d; ...

Table view gets cut off when rotating a UINavigationController.

My UITableView, actually all my subview, when i rotate the UINavigationController that is their parent. Any Ideas? ...