iphone

Can't include "self" in Objective-C description method?

I have a very straight forward class with mostly NSString type properties. In it, I wrote a trivial implementation of the description method. I found that whenever I try to include "self" in the description, it crashes my iPhone app. An example is something such as the following: - (NSString *)description { NSString *result; re...

Importing AddressBook data into the iPhone Simulator

Is there an easy way to import AddressBook data into the iPhone Simulator? Right now my only assumption is to manually modify the SQLite files found in the /Library/Application Support/iPhone Simulator/User/Library/AddressBook. ...

Is sqlite3_bind_text sufficient to prevent SQL injection on the iPhone

Given the statement: const char *sql = "INSERT INTO FooTable (barStr) VALUES (?)"; is the following use of sqlite3_bind_text (and related sqlite3_bind_* functions) sufficient to prevent SQL injection attacks? sqlite3 *db; sqlite3_stmt *dbps; int dbrc = sqlite3_open([dbFilePath UTF8String], &db); if (dbrc) { // handle error ...

Are there any tools or good techniques to find out where the performance bottlenecks are in an iPhone application?

I have an app that's half way done. The performance is not really good, and I wonder where the bottlenecks are. Although I can go ahead and start commenting out suspected lines of code, I wonder if there are any tools that would tell me which method cool took how long and what happened next. The stack trace isn't really that helpful. I ...

Finding exception in Objective c code

Hi I am debugging my application on iphone (OS 2.0) using X-code 3.1 iphone SDK 3.0 beta 5 . My application crashes giving message * Terminating app due to uncaught exception 'NSRangeException', reason: '* -[NSCFArray insertObject:atIndex:]: index (8) beyond bounds (8)' 2009-05-23 17:13:32.304 myApp[405:5a07] Stack: ( 808163835, ...

Code Vs. Interface Builder Iphone

I'm going through the Beginning Iphone Development Apress book and I'm constantly getting problems when building my NIB files. My practice apps crash because of the NIBS. I now this because I'll just trade out mine for the sample ones and the app will work. I'll look at the sample nib and all of my connections will be the same. I'm havin...

using image or tint color on uinavigationbar in iphone?

how do i show a background image on a navigation bar or give tint color to the navigation bar in a native iphone application?? ...

UIPickerview customisation

I would like to do some customization of the UIPickerView. End Goal: have a picker view rotating a few icon sized images. firstly i would like to change the black/grey boarder surrounding the spindle to a transparent colour. i.e. [UIColor clearColor]; Then shrink the picker view down so it is relatively small, (probably around 40 x 40...

Is it possible to connect iPhones through NAT traversal techniques over 3G for peer 2 peer gaming

Is it possible to connect an iPhone to another iPhone or any other network client talking that game's protocol. I was thinking that I could use the same NAT Traversal technique used in the XBox 360 to host games on users XBox's through Firewalls. For NAT traversal to work effectively I'd have to have a central server that would allow c...

Why does my iPhone app update from App Store fail while upgrading the database?

Hi, I've released an app update which does an upgrade of the database ie. executes a script file in the bundle that adds a column to existing table , etc. I've tested this by deploying previous version builds on my device from xcode and then deploying the latest version. The upgrade worked fine. Yesterday my distribution build got...

Core Data Primary Key

This may seem stupid, but I still couldn't figure out how to mark a attribute as a primary key in the xcdatamodel file. My persistent storage is sqlite file. Can anyone help me? In that case, how can I "validate" a ID to be unique? Should I write a validation method or something? ...

Are there easy functions for converting hours to seconds, seconds to hours, etc.?

I want to write some functions for that, but before I do: Are there any to convert between time units? ...

UITableViewCell's contentView's width with a given accessory type

On an iPhone, how do you figure out the width of a table view cell's content view when it is showing a certain accessory view (disclosure indicator, etc)? I need this in order to calculate the correct cell height for cells that contain wrapping, variable-length text. But when the table view delegate is asked for a cell height, it doesn...

Using different Apple ID for app testing and for App Store/iTunes purchase on same iPhone?

I signed up for the iPhone Developer Program (now awaiting approval) using a new Apple ID, this ID is different from the one I used on my iPhone for iTunes/AppStore purchase. I only have one iPhone and want to use the same device for app testing and day-to-day phone use. I can not try out yet but I guess iTunes/XCode will use the new A...

Who should call viewDidLoad on progammatically loaded views?

When I need to load a view programatically I do the following: MyController* myController = [[MyController alloc] init]; [[NSBundle mainBundle] loadNibNamed:@"myNib" owner:myController options:nil]; // use my controller here, eg. push it in the nav controller This works fine, but my controller's viewDidLoad is never called. So I resor...

Producer Consumer Issue with Core Data

I've a Core Data application. In the producer thread, I pull data from a web service and store it in my object and call save. My consumer object is a table view controller that displays the same. However, the app crashes and I get NSFetchedResultsController Error: expected to find object (entity: FeedEntry; id: 0xf46f40 ; data: ) in s...

iphone cocoa "error:request for member ____ in something not a structure or union"

this way works: type1ViewController *viewController = [[type1ViewController alloc] initWithNibName:@"Type1View" bundle:nil]; viewController.parentViewController = self; self.type1ViewController = viewController; [self.view insertSubview:viewController.view atIndex:0]; [viewController release]; but this way gives me the error, "request...

iphone keypad 'go' won't work jquery submit

Hello, I have a form on a page that has a submit button. If I hit the submit button it posts a jquery POST to another page and logs a user in. Works fine if I use the submit button on the page. If I click 'Go' on the numeric keypad it just refreshes the page. I assume this is because he form is like this (using iWebkit)... <span class...

iPhone: Convert date string to a relative time stamp

I've got a timestamp as a string like: Thu, 21 May 09 19:10:09 -0700 and I'd like to convert it to a relative time stamp like '20 minutes ago' or '3 days ago'. What's the best way to do this using Objective-C for the iPhone? ...

Way to make a UIButton continuously fire during a press-and-hold situation?

You know how Mario just keeps running to the right when you press and hold the right-button on the D-Pad? In the same manner, I want my UIButton to continuously fire its action for the duration that it is held down. Is this possible for a UIButton? If not, is this possible to do with a UIImageView by overriding a touch handling method in...