Skip to content

Instantly share code, notes, and snippets.

@ironfounderson
Created December 22, 2010 08:16
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ironfounderson/751259 to your computer and use it in GitHub Desktop.
Save ironfounderson/751259 to your computer and use it in GitHub Desktop.
Loading content from a file contained as a bundle resource within a unit test target
- (NSString *)contentOfXMLFile:(NSString *)filename {
NSString *contentPath = [[NSBundle bundleForClass:[self class]] pathForResource:filename
ofType:@"xml"];
NSURL *contentURL = [NSURL fileURLWithPath:contentPath];
return [NSString stringWithContentsOfURL:contentURL
encoding:NSUTF8StringEncoding
error:nil];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment