views:

1226

answers:

1

I have following code in my application.

NSData *data=[NSData dataWithContentsOfURL:[NSURL URLWithString:pathOfThumbNail]];

pathOfThumbNail has following path


http://70.84.58.40/projects/igolf/TipThumb/GOLF 58B.jpg


When I open above path in safari browser - path is changed automatically & image is successfully displayed.

http://70.84.58.40/projects/igolf/TipThumb/GOLF%2058B.jpg


But in iPhone, due to space in path, image isn't loaded in nsdata.

+5  A: 

Use: stringByAddingPercentEscapesUsingEncoding:

Returns a representation of the receiver using a given encoding to determine the percent escapes necessary to convert the receiver into a legal URL string.

  • (NSString *)stringByAddingPercentEscapesUsingEncoding:(NSStringEncoding)encoding

A representation of the receiver using encoding to determine the percent escapes necessary to convert the receiver into a legal URL string. Returns nil if encoding cannot encode a particular character

zaph
Great ! Exactly as I wanted. Actually I knew it but forgotten due to project load. Hats of for your kind help to me.
sugar