objective-c

What is the simplest way to setup a server to read data from incoming socket connections?

What is the simplest way (preferably without using third party frameworks) in objective c, to setup a simple server that listens for socket connections, and reads data from the clients on a line by line basis. ie Ideally you would just need to create an instance of a "server" object, that would pass "client" objects back to which receiv...

Taking Command Line Input in Objective C

Is there anyway we can take input from command line in Objective-C, the way we can take in C/C++ e.g; int inputVariableName; cin>>inputVariableName; ...

mac screensaver start event

Is there an event fired when screensaver starts? Like for keychain locking: OSStatus keychain_locked(SecKeychainEvent keychainEvent, SecKeychainCallbackInfo *info, void *context){...} ...

Can UIViewController contain more than one UIView?

Can a UIViewcontroller contain more than one UIView? ...

How to identify button press among several button in objective c

I have 4 button (b1,b2,b3,b4) and a label (lab).Now I want to display button title in label when a particular button is pressed.i did it with four (IBAction) method one for every button.But i want to do it with 1(IBAction) method.so the problem is to to how to identify which button is pressed??? i knew a method something like "getBytitle...

pause and resume the app

I learnt that to pause and resume my app (due to interruptions) i have to use the application delegate method "applicationWillResignActive" . But am not clear of the statements within this function. can anyone explain as to what should be enclosed in this method? ...

Augmented Reality with iPhone 3GS and UIView

Hi, I am experimenting a bit with the iPhone 3GS and its magnetic sensors. It is quite simple to get the heading and the angle of the north pole seen from the top of the device. Also getting the position of the device itself via accelerometer is quite easy. But getting it all together deserves some math knowledge regarding vector calcula...

Which memory is released by didReceiveMemoryWarning/viewDidUnload?

My iPhone application is running into problems when deployed to the device, principally because I haven't handled memory warnings thus far (no problem in the simulator, with 4GB of ram on my dev machine!). No problem there, I just need to handle these warnings more skilfully (less suckily...). Question is, which memory does the runtime...

creating a timer when firing a function

Hello all , I'd like to create some sort of timer that will take the time between firing different kind of functions but I'm having no such luck so far. I assumed I should use the NSDate object and I've done this so far. I've created several functions -(void)startTime:(id)sender { starttime = [NSDate date]; **[starttime re...

Detecting time when user does nothing

Hello guys, I am writing an application that is hidden most of the time but sometimes it should pop up on the user's desktop. (It is in cocoa and objective-c) I don't want to disturb my dear users when they are busy e.g. watching a movie or actively chating with friends etc. I would like that my app pops up only when user is not busy w...

How to "pass on" a variable number of arguments to NSString's +stringWithFormat:

I would like to write a function in Objective-C such as the one below, that takes a variable number of arguments, and passes those arguments on to +stringWithFormat:. I know about vsnprintf, but that would imply converting the NSString 'format' to C and back (and would also mean converting the formatting placeholders within it as well......

HTTP Authentication for iPhone

Probably Duplicate of Basic HTTP Authentication on iPhone HttpBasicAuthentication in IPhone i want to write an http authentication program for iphone. should i do it using soap request or NSURLConnection? Please give me one good link where i can get help how to do it step by step , Regards, ...

When are released objects finally destroyed?

When you release an object in Objective-C (assuming its release count is 1) its release count is decremented to 0 and the dealloc method called. Is the object destroyed right there and then after the [super dealloc], or is it added to the pool and destroyed when the pool is drained? I would assume that released objects are destroyed at ...

How to send message from iphone/touch to server(tomcat) ?

Hi, I have native iphone/ipod touch application.After enter the infomation on that application it will store into server database,again send message to iphone/ipod.Using objective c how to do ? Please help me out... ...

NSMutableArray passing by parameter memory leak

Hi guys, I'm experiencing a hard issue here, would appreciate any, I mean ANY help =) I'm a experienced developer by I'm new to Objective-C/iPhone/Cocoa. I wanna create a class controller which I'm able to pass a NSMutableArray as a parameter. Then, we have: selTimeIntController = [[SingleSelectPickerViewController alloc] initWithSet...

trying to strip out whitespace doesn't work in NSXMLparser foundCharacters method

hello all, I'm parsing an xml file and i've been trying to strip out the whitespace characters in my currentElementValue because it's messing up a couple of things. I can see in my output window that a couple of carriage returns and tabs are present (gdb) po string Keep the arms on the side, and lift your leg. (gdb) po currentElementV...

SQLite behaviour on INSERT on iPhone

I'm currently doing the following as part of my iPhone application NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSString *documentsPath = [paths objectAtIndex:0]; NSString *filePath = [documentsPath stringByAppendingPathComponent:@"cities.sqlite"]; sqlite3 *database; if(sqlite3_open...

How I get the tag value from the sender

- (IBAction)onClick1:(id)sender { // Make sure it's a UIButton if (![sender isKindOfClass:[UIButton class]]) return; NSString *title = [(UIButton *)sender currentTitle]; } I understand how to get the title and other current values but I don't see how I can get the value of the tag property. ...

How do I set the firstresponder?

I have a view built through IB, there's a text view and and button on it. When the view shows up I would like to have the keyboard to be already displayed. I tried to set the first responder in the didViewLoad but that didn't work. I do have an IBOutlet that is connected to the textView and related accessor. ...

Sorting an array of doubles or CLLocationDistance values on the iPhone

I'm trying to sort a list of CLLocationDistance values by closest distance (ascending order). I first converted the values to NSString objects so that I could use the following sort: NSArray *sortedArray; sortedArray = [distances sortedArrayUsingSelector:@selector(caseInsensitiveCompare:)]; NSString cannot sort on the numeric value. ...