Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

AbhishekApple

macrumors member
Original poster
Aug 5, 2010
86
0
I am trying to initialize a NSstring,NSUrl but it is not accepting value with in a touchup event if variables are declared locally but if i declare NSstring globally it accepts value:confused:

Code:
-(IBAction)btnLoginGoClicked:(id)sender
{
NSString *userid,*pass;
userid=txtUserId.text;
pass= txtPassword.text;

NSString *loginurl= [[NSString alloc] initWithFormat:@"http://abc.com/email=%@&password=%@&chk=&requestFlag=appRequest",userid,pass];  

NSUrl *url = [NSURL URLWithString:loginurl];

===>shows NSString * loginurl <variable nil    ===>on breakpoint 

ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:url];
[loginurl release];
[request setDelegate:self];
[request startAsynchronous];
Pls ny one can explain
 

Sykte

macrumors regular
Aug 26, 2010
223
0
Hint 1:
A couple of the variables that should be pointers are not.


Hint 2:
If a variable or object are returning nil when they should be initialized, check the object/variable immediately after initialization.
 

ulbador

macrumors 68000
Feb 11, 2010
1,554
0
The previous poster is correct. loginurl and url should be declared as pointers (*)
 

robbieduncan

Moderator emeritus
Jul 24, 2002
25,611
893
Harrogate
And the class NSUrl does not exist (but NSURL does).

I suspect that instead of copy/pasting the exact code which is the only way to get useful help the poster has typed roughly the same, but not exactly the same into here.

OP: if you want help:

1) Copy and paste the exact code
2) Do a clean build and not any compiler warnings. If there are any then fix them and go back to 1)
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.