0

How to parse an xcode url and get data that returns i.e

1

bilal

engineer

to different xcode fields i.e

NSString *id=1
NSString *name=bilal
NSString *designation=engineer

note. my url is self constructed to simply return the fields

3
  • 1
    What's an "xcode url", out of curiosity? Commented Apr 28, 2011 at 5:06
  • result = [NSString stringWithFormat: "dev.evsoft.pk/fgglobal/…; it's something like that man Commented Apr 28, 2011 at 5:17
  • dev.evsoft.pk/fgglobal/… how do you think i can get the values of u and p from the above string in xcode???????? Commented Apr 28, 2011 at 5:26

1 Answer 1

2

I don't know if you are already establishing a connection to your web service or not… if not look up NSURLConnection in Google or Stack Overflow.

Regarding the only part of your question that I understood:

NSString* result = @"1\nbilal\nengineer";
NSArray* components = [result componentsSeparatedByString:@"\n"];

NSString* id = [components objectAtIndex:0];
NSString* name = [components objectAtIndex:1];
NSString* designation = [components objectAtIndex:2];
Sign up to request clarification or add additional context in comments.

9 Comments

id is not a keyword in Objective-C. It’s a type name and, since types are in a different name space than the name space for variables, id is also a valid variable name.
Oops you're right, I removed that bit of misinformation from my answer.
yes i know that about id.. i was just explaining my requiremnt
@Bavarious, that's not quite true. Yes, id is a type, but according to this page it's also a reserved word. That makes sense because id has some special behavior. It's a built-in type that can be used in place of any object pointer type, and when you use it you're basically saying "I don't care about the type."
dev.evsoft.pk/fgglobal/… how do you think i can get the values of u and p from the above string in xcode????????
|

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.