This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
NSError *error = nil; | |
ITLibrary *library = [ITLibrary libraryWithAPIVersion:@"1.0" error:&error]; | |
if (library) | |
{ | |
NSArray *playlists = library.allPlaylists; | |
NSArray *tracks = library.allMediaItems; | |
NSLog(@"Playlists count: %lu", [playlists count]); | |
NSLog(@"Tracks count: %lu", [tracks count]); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification | |
{ | |
NSString *path = [NSString stringWithFormat:@"%@/Music/iTunes/iTunes Library.xml", NSHomeDirectory()]; | |
NSData *xmlData; | |
NSDictionary *plist; | |
xmlData = [NSData dataWithContentsOfFile:path]; | |
NSString *error; | |
NSPropertyListFormat format; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Subclassing in this case wins over mocking | |
*/ | |
@interface MockHTTPURLResponse : NSHTTPURLResponse { | |
NSInteger statusCode; | |
} | |
@property(readwrite,nonatomic) NSInteger statusCode; | |
@end | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
NSInteger result = 401; | |
const void *val = &result; | |
id mockResponse = [OCMockObject mockForClass:[NSHTTPURLResponse class]]; | |
[[[mockResponse stub] andReturn:[NSValue value:val withObjCType:@encode(NSInteger)]] statusCode]; |
NewerOlder