objective-c

decodeHexString obj-c implementation, Should I support odd lengthed hexstrings, and if so, how?

I may be missing something in the standard libs, but I don't think so. I have this current implementation: int char2hex(unsigned char c) { switch (c) { case '0' ... '9': return c - '0'; case 'a' ... 'f': return c - 'a' + 10; case 'A' ... 'F': return c - 'A' + 10; default: WARNING(@"pa...

What does !! mean in Objective-C

Hei, I have this code: - (BOOL)isConnected { return !!_sessionKey; } where _sessionKey is defined earlier as: NSString* _sessionKey; the code comes from the facebook-connect for iphone. Since I am learning Objective-C by looking at code written by other people. The !! used in the isConnection function seems useless to me, or am I...

OBJC_MSGSEND Error in NSString stringWithFormat

I have a button in a test iPhone0 application that opens StackOverflow questions based on their GET ID in the URL. Every time the button is pressed, the page should reload to the next question. I keep count of the GET ID through a int count initially set to 1 and incremented every button press. Hard-coding the URL using: NSString *urlA...

Sending NSMutableArray on AsycSocket

Any one knows how to write and read NSMutableArray or Dictionary data using AsycSocket Library ? Clarification: I want a way to archive NSMuatbleArray and write this on the stream. seemed pretty forward but running in simulator I get this wierd error [NSKeyedUnarchiver initForReadingWithData:]: incomprehensible archive ...

Property & Private & extended class combination confusion of interface

I have downloaded a sample code of AA-Plot Chart. One of the .h files: @interface MainViewController : UIViewController <APYahooDataPullerDelegate, CPPlotDataSource> { CPLayerHostingView *layerHost; @private APYahooDataPuller *datapuller; CPXYGraph *graph; } @property (nonatomic, retain) IBOutlet CPLayerHostingView *la...

Should I use sqlite3_finalize after i performed a query with sqlite3_exec?

Hi, I'm using Sqlite3 in my iPhone app, I was getting some unwanted rollbacks apparently in a random basis, However I don't know if this has something to do with the fact that I don't finalize the statements with sqlite3_finalize, since as far as I know sqlite3_exec takes care of it. Also I found some SELECTs with sqlite3_prepare_v2 tha...

NSXMLParser chokes on ampersand &

I'm parsing some HTML with NSXMLParser and it hits a parser error anytime it encounters an ampersand. I could filter out ampersands before I parse it, but I'd rather parse everything that's there. It's giving me error 68, NSXMLParserNAMERequiredError: Name is required. My best guess is that it's a character set issue. I'm a little fuz...

Mediaplayer: Is it possible to distinguish finish from 'Done' with myMovieFinishedCallback?

I am using the MediaPlayer framework to play a movie on the iPhone. There is a notification:- myMovieFinishedCallback to capture the end of play, but there doesn't appear to be any way to distinguish between the player coming to the end of the movie, and the user pressing 'Done' to terminate mid-play. Is it possible to tell the cond...

NSString setter using isEqualToString

In the Pragmatic Core Data book, I came across this code snippet for an NSString setter: - (void)setMyString:(NSString*)string; { @synchronized(self) { if ([string isEqualToString:myString]) return; [myString release]; myString = [string retain]; } } Is there any reason to use [string isEqualToString:myString] instead of...

How to Call an application in my XCode project?

Hi, I want to know how to write a program in Objective-C language in XCode for iPhone OS, i want to call an application(Ex: hello world) from another application(its a calling application, whose functionality is just to call hello world application). how to give the path of hello world in the calling application and where to place my he...

NSTableView - toggling between 2 datasources.

I have a small cocoa app, and the UI consists mainly of a single NSTableView. However I have 2 different lists of data that I would like to display in it, and then just toggle between the two. My question is, what do you think is the best way to implement this? Now I figure I could use a BOOL flag to change which Array gets used in the ...

a table view from modal view

I am designing application which is completely based on modal view controllers. now, after i navigate 4 to 5 screens of my application i want to show the data in tabular format. All sample applications show table view as the first screen . Please tell me how am i to show the table view later on My case is: I give the start date and end...

how to declare color for Label

Hi guys Good Morning, Here is my question is i have done simple application its just like when a tab a button it will show a MEsssage like "How do u do " Now i want to keep a color to the TEXt how to do it, i have written like below #import "tr1ViewController.h" @implementation tr1ViewController - (IBAction)butt { label.text ...

Geolocation API on Max OS X Snow Leopard

Has anyone written an application that uses the new location API in Mac OS X 10.6? There is a sample program that uses the same API for the iPhone OS, but the API is slightly different for Mac OS X, and Apple provides no sample program using it. Edit: I know how to use it, the API documentation is ok. It seems overly complex for simple...

Save full webpage

Hello! I've bumped into a problem while working at a project. I want to "crawl" certain websites of interest and save them as "full web page" including styles and images in order to build a mirror for them. It happened to me several times to bookmark a website in order to read it later and after few days the website was down because it ...

Property List vs XML in iPhone

I have to save some config parameters with values in iPhone. I need to edit values at app runtime. I see there are two ways to implement this: 1. Use pList file 2. Create new XML file. What is the best approach to implement this? Should I use existing Info.pList file? Thanks ...

UINavigationBar vs UIToolbar vs UITabBar in iPhone

Let me know which one should be used in what case. What are differences among them? What are the advantage and disadvantage of each component? Thanks ...

Simple Way to Strip Tags In Obj-C

I am just learning objective-c and iPhone development, and I am really struggling with some very basic tasks. I am only on my 3rd day of the learning process - so that is to be expected somewhat. I'm still almost ashamed to ask such a simple question. Anyhow, here's my question. I have a .NET web service which I call using a GET for htt...

Smoothing out didAccelerate messages

I'm working on something similar to an inclinometer. I rotate an image based on the angle calculated in didAccelerate (from UIAccelerometerDelegate) using the passed in UIAcceleration variable. The image is jittery or twitchy. Even when the phone is laying on its back and not moving. There are some inclinometers in the app store tha...

Bluetooth Objective-C

Is there somewhere I can find example code for listing bluetooth devices natively, as quickly as possible, in Mac OS X? (I'm assuming this will entail Objective-C) I'm trying to write a very simple terminal app that will scan for bluetooth devices at regular (specified) intervals and list the bluetooth network addresses (the hex digits)...