0

I've got a server on which I can run PHP scripts and an application which is written in Objective-C and Cocoa.

What's the easiest way to send multiple strings (in my case 4) from the server to the client?

1 Answer 1

1

Easiest methods for receiving data/strings from the web:

For pure data:

NSData *myData = [NSData dataWithContentsOfURL:myURL];

For an actual string:

NSError *error = nil;
NSString *myString = [NSString stringWithContentsOfURL:myURL encoding:NSUTF8StringEncoding error:&error];
if (error) {
    NSLog(@"Could not receive string: %@", error);
}

These two calls fire a synchronous request, blocking your thread.
For asynchronous non-blocking requests read Apple's URL Loading System Programming Guide for full instructions.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.