NSAutoreleasePool *pool([[NSAutoreleasePool alloc] init]);
- if (kCFCoreFoundationVersionNumber >= 847.24)
+ if (kCFCoreFoundationVersionNumber >= 800)
if (NSString *error = download()) {
fprintf(stderr, "error: %s\n", [error UTF8String]);
return 1;
}
- NSString *path(@"/System/Library/Lockdown/Services.plist");
- NSMutableDictionary *services([NSMutableDictionary dictionaryWithContentsOfFile:path]);
+ if (kCFCoreFoundationVersionNumber < 1000) {
+ NSString *path(@"/System/Library/Lockdown/Services.plist");
- [services setObject:@{
- @"AllowUnactivatedService": @true,
- @"Label": @"com.apple.afc2",
- @"ProgramArguments": @[@"/usr/libexec/afc2d", @"-S", @"-L", @"-d", @"/"],
- } forKey:@"com.apple.afc2"];
+ NSMutableDictionary *services([NSMutableDictionary dictionaryWithContentsOfFile:path]);
+ if (services == nil) {
+ fprintf(stderr, "cannot read Services.plist\n");
+ return 1;
+ }
+
+ [services setObject:@{
+ @"AllowUnactivatedService": @true,
+ @"Label": @"com.apple.afc2",
+ @"ProgramArguments": @[@"/usr/libexec/afc2d", @"-S", @"-L", @"-d", @"/"],
+ } forKey:@"com.apple.afc2"];
+
+ if (![services writeToFile:path atomically:YES]) {
+ fprintf(stderr, "cannot write Services.plist\n");
+ return 1;
+ }
+ }
- [services writeToFile:path atomically:YES];
system("/bin/launchctl stop com.apple.mobile.lockdown");
[pool release];
-
return 0;
}