how can i convert NSURLRequest to NSString ?
+3
A:
Depends on the information you want in the string. Do you want to have it contain all the values of the instance variables in the object? If so, you're going to need to write your own method that does that. Perhaps subclass NSURLRequest
and override description
. You could also use reflection to get at all the private ivars and print everything out from another class.
Or just use a debugger to inspect the values.
Marc W
2010-03-06 22:20:27
tnx dude...but i'm new to cocoa... in my code : NSURLRequest *newRequest=request; NSLog(@"%@",newRequest);// <NSURLRequest http://world.yahoo.com/>i need put "<NSURLRequest http://world.yahoo.com/>" in to the String variable.
Naeim
2010-03-06 22:31:13
`NSLog(@"<NSURLRequest %@>", [[newRequest URL] absoluteString]);` Take a look a the API docs for `NSURLRequest`: http://developer.apple.com/mac/library/documentation/cocoa/reference/Foundation/Classes/NSURLRequest_Class/Reference/Reference.html
Marc W
2010-03-06 22:34:18
tnx Marc; NSString *naeim = [[newRequest URL] absoluteString];this command was true ;) .
Naeim
2010-03-06 22:42:31