Depending on the Monogenerator or not, I will use the second approach. Override "getters" and "seters", match from URL to string using
NSString *urlString = [url absoluteString];
and use setPrimitiveValue:forKey:its analogue, for example
- (void)setYourURL:(NSURL*)newURL {
[self willChangeValueForKey:@"yourURL"];
NSString* yourURLAsString =
[self setPrimitiveValue:yourURLAsString forKey:@"yourURL"];
[self didChangeValueForKey:@"yourURL"];
}
If your URL has spaces, you might also think to replace them with stringByReplacingPercentEscapesUsingEncoding:.
source
share