Iphone : Problem regarding replacing String?
I Want Replace String ':' by '/',
I am Using this code to replace
NSString *newPath = [imgPath stringByReplacingOccurrencesOfString:@":" withString:@"/"];
But at a time, I get this error
-[__NSCFDictionary stringByReplacingOccurrencesOfString:withString:]: unrecognized selector sent to instance 0x664e650
W开发者_JAVA技巧hat Should I do ?
- imgPath is NSDictionary should be NSString.
- If imgpath is NSStRING, probably it is released already
I feel there might be some structured organized way the data in your NSString. I faced a similar situation . I had my data with recursive {}. You should replace NSString *imgPath to NSDictionary *dictPath . Having done that read your fields with [dictPath objectForKey:@"key"] than read the fields again in NSString and remove special characters.
精彩评论