Changeset 11714 for lang/objective-c
- Timestamp:
- 05/17/08 03:49:27 (6 months ago)
- Location:
- lang/objective-c/HatebuCoreData
- Files:
-
- 7 added
- 2 removed
- 4 modified
-
Bookmark.h (modified) (1 diff)
-
Bookmark.m (modified) (1 diff)
-
BookmarkTest.h (added)
-
BookmarkTest.m (added)
-
FakeBookmark.h (added)
-
FakeBookmark.m (added)
-
HatebuCoreData.xcodeproj/project.pbxproj (modified) (15 diffs)
-
HatebuCoreData_AppDelegate.m (modified) (10 diffs)
-
HatenaBookmark.h (added)
-
HatenaBookmark.m (added)
-
NetworkProxy.h (deleted)
-
NetworkProxy.m (deleted)
-
UnitTest-Info.plist (added)
Legend:
- Unmodified
- Added
- Removed
-
lang/objective-c/HatebuCoreData/Bookmark.h
r11706 r11714 11 11 12 12 @interface Bookmark : NSManagedObject { 13 BOOL updated_; 13 14 14 15 } 15 16 16 - (void) awakeFromFetch;17 -(void)update; 17 18 18 19 @end -
lang/objective-c/HatebuCoreData/Bookmark.m
r11706 r11714 9 9 #import "Bookmark.h" 10 10 11 12 11 @implementation Bookmark 13 12 #if 0 14 13 - (void) awakeFromFetch { 15 14 NSLog(@"Bookmark#awakeFromFetch: %@", self); 16 15 } 16 #endif // 0 17 18 - (void) willSave { 19 NSLog(@"Bookmark#willSave: %@", self); 20 [self update]; 21 } 22 23 -(void) update { 24 abort(); 25 } 17 26 18 27 @end -
lang/objective-c/HatebuCoreData/HatebuCoreData.xcodeproj/project.pbxproj
r11706 r11714 14 14 8609DD8F0DDC0DF300E2B4DD /* BookmarkController.m in Sources */ = {isa = PBXBuildFile; fileRef = 8609DD8E0DDC0DF300E2B4DD /* BookmarkController.m */; }; 15 15 8698C85D0DDD60B800294DC6 /* Bookmark.m in Sources */ = {isa = PBXBuildFile; fileRef = 8698C85C0DDD60B800294DC6 /* Bookmark.m */; }; 16 8698C8630DDD83AE00294DC6 /* NetworkProxy.m in Sources */ = {isa = PBXBuildFile; fileRef = 8698C8620DDD83AE00294DC6 /* NetworkProxy.m */; }; 16 8698C8850DDDBC9000294DC6 /* SenTestingKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8698C8840DDDBC9000294DC6 /* SenTestingKit.framework */; }; 17 86FD38540DDE09EE0016EAA6 /* FakeBookmark.m in Sources */ = {isa = PBXBuildFile; fileRef = 86FD38530DDE09EE0016EAA6 /* FakeBookmark.m */; }; 18 86FD385A0DDE0AB70016EAA6 /* BookmarkTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 86FD38590DDE0AB70016EAA6 /* BookmarkTest.m */; }; 19 86FD38600DDE0B4C0016EAA6 /* Bookmark.m in Sources */ = {isa = PBXBuildFile; fileRef = 8698C85C0DDD60B800294DC6 /* Bookmark.m */; }; 17 20 8D11072B0486CEB800E47090 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 089C165CFE840E0CC02AAC07 /* InfoPlist.strings */; }; 18 21 8D11072D0486CEB800E47090 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 29B97316FDCFA39411CA2CEA /* main.m */; settings = {ATTRIBUTES = (); }; }; … … 38 41 8698C85B0DDD60B800294DC6 /* Bookmark.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Bookmark.h; sourceTree = "<group>"; }; 39 42 8698C85C0DDD60B800294DC6 /* Bookmark.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Bookmark.m; sourceTree = "<group>"; }; 40 8698C8610DDD83AE00294DC6 /* NetworkProxy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NetworkProxy.h; sourceTree = "<group>"; }; 41 8698C8620DDD83AE00294DC6 /* NetworkProxy.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NetworkProxy.m; sourceTree = "<group>"; }; 43 8698C8700DDDBB8700294DC6 /* UnitTest.octest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = UnitTest.octest; sourceTree = BUILT_PRODUCTS_DIR; }; 44 8698C8710DDDBB8700294DC6 /* UnitTest-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "UnitTest-Info.plist"; sourceTree = "<group>"; }; 45 8698C8840DDDBC9000294DC6 /* SenTestingKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SenTestingKit.framework; path = Library/Frameworks/SenTestingKit.framework; sourceTree = DEVELOPER_DIR; }; 46 86FD383A0DDE073A0016EAA6 /* HatenaBookmark.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HatenaBookmark.h; sourceTree = "<group>"; }; 47 86FD383B0DDE073A0016EAA6 /* HatenaBookmark.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HatenaBookmark.m; sourceTree = "<group>"; }; 48 86FD38520DDE09EE0016EAA6 /* FakeBookmark.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FakeBookmark.h; sourceTree = "<group>"; }; 49 86FD38530DDE09EE0016EAA6 /* FakeBookmark.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FakeBookmark.m; sourceTree = "<group>"; }; 50 86FD38580DDE0AB70016EAA6 /* BookmarkTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BookmarkTest.h; sourceTree = "<group>"; }; 51 86FD38590DDE0AB70016EAA6 /* BookmarkTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BookmarkTest.m; sourceTree = "<group>"; }; 42 52 8D1107310486CEB800E47090 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist; path = Info.plist; sourceTree = "<group>"; }; 43 53 8D1107320486CEB800E47090 /* HatebuCoreData.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = HatebuCoreData.app; sourceTree = BUILT_PRODUCTS_DIR; }; … … 45 55 46 56 /* Begin PBXFrameworksBuildPhase section */ 57 8698C86D0DDDBB8700294DC6 /* Frameworks */ = { 58 isa = PBXFrameworksBuildPhase; 59 buildActionMask = 2147483647; 60 files = ( 61 8698C8850DDDBC9000294DC6 /* SenTestingKit.framework in Frameworks */, 62 ); 63 runOnlyForDeploymentPostprocessing = 0; 64 }; 47 65 8D11072E0486CEB800E47090 /* Frameworks */ = { 48 66 isa = PBXFrameworksBuildPhase; … … 67 85 8698C85B0DDD60B800294DC6 /* Bookmark.h */, 68 86 8698C85C0DDD60B800294DC6 /* Bookmark.m */, 69 8698C8610DDD83AE00294DC6 /* NetworkProxy.h */, 70 8698C8620DDD83AE00294DC6 /* NetworkProxy.m */, 87 86FD383A0DDE073A0016EAA6 /* HatenaBookmark.h */, 88 86FD383B0DDE073A0016EAA6 /* HatenaBookmark.m */, 89 86FD38520DDE09EE0016EAA6 /* FakeBookmark.h */, 90 86FD38530DDE09EE0016EAA6 /* FakeBookmark.m */, 71 91 ); 72 92 name = Classes; … … 76 96 isa = PBXGroup; 77 97 children = ( 98 8698C8840DDDBC9000294DC6 /* SenTestingKit.framework */, 78 99 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */, 79 100 ); … … 95 116 children = ( 96 117 8D1107320486CEB800E47090 /* HatebuCoreData.app */, 118 8698C8700DDDBB8700294DC6 /* UnitTest.octest */, 97 119 ); 98 120 name = Products; … … 102 124 isa = PBXGroup; 103 125 children = ( 126 8698C8750DDDBBE100294DC6 /* Test Cases */, 104 127 7756732906782D8800D1FEB8 /* Models */, 105 128 080E96DDFE201D6D7F000001 /* Classes */, … … 109 132 19C28FACFE9D520D11CA2CBB /* Products */, 110 133 8609D26E0DDC212C00589FA4 /* MainMenu.nib */, 134 8698C8710DDDBB8700294DC6 /* UnitTest-Info.plist */, 111 135 ); 112 136 name = HatebuCoreData; … … 148 172 sourceTree = "<group>"; 149 173 }; 174 8698C8750DDDBBE100294DC6 /* Test Cases */ = { 175 isa = PBXGroup; 176 children = ( 177 86FD38580DDE0AB70016EAA6 /* BookmarkTest.h */, 178 86FD38590DDE0AB70016EAA6 /* BookmarkTest.m */, 179 ); 180 name = "Test Cases"; 181 sourceTree = "<group>"; 182 }; 150 183 /* End PBXGroup section */ 151 184 152 185 /* Begin PBXNativeTarget section */ 186 8698C86F0DDDBB8700294DC6 /* UnitTest */ = { 187 isa = PBXNativeTarget; 188 buildConfigurationList = 8698C8740DDDBB8800294DC6 /* Build configuration list for PBXNativeTarget "UnitTest" */; 189 buildPhases = ( 190 8698C86B0DDDBB8700294DC6 /* Resources */, 191 8698C86C0DDDBB8700294DC6 /* Sources */, 192 8698C86D0DDDBB8700294DC6 /* Frameworks */, 193 8698C86E0DDDBB8700294DC6 /* ShellScript */, 194 ); 195 buildRules = ( 196 ); 197 dependencies = ( 198 ); 199 name = UnitTest; 200 productName = UnitTest; 201 productReference = 8698C8700DDDBB8700294DC6 /* UnitTest.octest */; 202 productType = "com.apple.product-type.bundle"; 203 }; 153 204 8D1107260486CEB800E47090 /* HatebuCoreData */ = { 154 205 isa = PBXNativeTarget; … … 182 233 targets = ( 183 234 8D1107260486CEB800E47090 /* HatebuCoreData */, 235 8698C86F0DDDBB8700294DC6 /* UnitTest */, 184 236 ); 185 237 }; … … 187 239 188 240 /* Begin PBXResourcesBuildPhase section */ 241 8698C86B0DDDBB8700294DC6 /* Resources */ = { 242 isa = PBXResourcesBuildPhase; 243 buildActionMask = 2147483647; 244 files = ( 245 ); 246 runOnlyForDeploymentPostprocessing = 0; 247 }; 189 248 8D1107290486CEB800E47090 /* Resources */ = { 190 249 isa = PBXResourcesBuildPhase; … … 198 257 /* End PBXResourcesBuildPhase section */ 199 258 259 /* Begin PBXShellScriptBuildPhase section */ 260 8698C86E0DDDBB8700294DC6 /* ShellScript */ = { 261 isa = PBXShellScriptBuildPhase; 262 buildActionMask = 2147483647; 263 files = ( 264 ); 265 inputPaths = ( 266 ); 267 outputPaths = ( 268 ); 269 runOnlyForDeploymentPostprocessing = 0; 270 shellPath = /bin/sh; 271 shellScript = "# Run the unit tests in this test bundle.\n\"${SYSTEM_DEVELOPER_DIR}/Tools/RunUnitTests\"\n"; 272 }; 273 /* End PBXShellScriptBuildPhase section */ 274 200 275 /* Begin PBXSourcesBuildPhase section */ 276 8698C86C0DDDBB8700294DC6 /* Sources */ = { 277 isa = PBXSourcesBuildPhase; 278 buildActionMask = 2147483647; 279 files = ( 280 86FD38540DDE09EE0016EAA6 /* FakeBookmark.m in Sources */, 281 86FD385A0DDE0AB70016EAA6 /* BookmarkTest.m in Sources */, 282 86FD38600DDE0B4C0016EAA6 /* Bookmark.m in Sources */, 283 ); 284 runOnlyForDeploymentPostprocessing = 0; 285 }; 201 286 8D11072C0486CEB800E47090 /* Sources */ = { 202 287 isa = PBXSourcesBuildPhase; … … 209 294 8609DD8F0DDC0DF300E2B4DD /* BookmarkController.m in Sources */, 210 295 8698C85D0DDD60B800294DC6 /* Bookmark.m in Sources */, 211 8698C8630DDD83AE00294DC6 /* NetworkProxy.m in Sources */,212 296 ); 213 297 runOnlyForDeploymentPostprocessing = 0; … … 291 375 name = Release; 292 376 }; 377 8698C8720DDDBB8700294DC6 /* Debug */ = { 378 isa = XCBuildConfiguration; 379 buildSettings = { 380 ALWAYS_SEARCH_USER_PATHS = NO; 381 ARCHS = "$(NATIVE_ARCH)"; 382 COPY_PHASE_STRIP = NO; 383 FRAMEWORK_SEARCH_PATHS = "$(DEVELOPER_LIBRARY_DIR)/Frameworks"; 384 GCC_DYNAMIC_NO_PIC = NO; 385 GCC_ENABLE_FIX_AND_CONTINUE = NO; 386 GCC_ENABLE_OBJC_EXCEPTIONS = YES; 387 GCC_MODEL_TUNING = G5; 388 GCC_OPTIMIZATION_LEVEL = 0; 389 GCC_PRECOMPILE_PREFIX_HEADER = YES; 390 GCC_PREFIX_HEADER = "$(SYSTEM_LIBRARY_DIR)/Frameworks/Cocoa.framework/Headers/Cocoa.h"; 391 INFOPLIST_FILE = "UnitTest-Info.plist"; 392 INSTALL_PATH = "$(USER_LIBRARY_DIR)/Bundles"; 393 OTHER_LDFLAGS = ( 394 "-framework", 395 Cocoa, 396 "-framework", 397 SenTestingKit, 398 ); 399 PREBINDING = NO; 400 PRODUCT_NAME = UnitTest; 401 WRAPPER_EXTENSION = octest; 402 }; 403 name = Debug; 404 }; 405 8698C8730DDDBB8700294DC6 /* Release */ = { 406 isa = XCBuildConfiguration; 407 buildSettings = { 408 ALWAYS_SEARCH_USER_PATHS = NO; 409 ARCHS = "$(ARCHS_STANDARD_32_BIT)"; 410 COPY_PHASE_STRIP = YES; 411 DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 412 FRAMEWORK_SEARCH_PATHS = "$(DEVELOPER_LIBRARY_DIR)/Frameworks"; 413 GCC_ENABLE_FIX_AND_CONTINUE = NO; 414 GCC_ENABLE_OBJC_EXCEPTIONS = YES; 415 GCC_MODEL_TUNING = G5; 416 GCC_PRECOMPILE_PREFIX_HEADER = YES; 417 GCC_PREFIX_HEADER = "$(SYSTEM_LIBRARY_DIR)/Frameworks/Cocoa.framework/Headers/Cocoa.h"; 418 INFOPLIST_FILE = "UnitTest-Info.plist"; 419 INSTALL_PATH = "$(USER_LIBRARY_DIR)/Bundles"; 420 OTHER_LDFLAGS = ( 421 "-framework", 422 Cocoa, 423 "-framework", 424 SenTestingKit, 425 ); 426 PREBINDING = NO; 427 PRODUCT_NAME = UnitTest; 428 WRAPPER_EXTENSION = octest; 429 ZERO_LINK = NO; 430 }; 431 name = Release; 432 }; 293 433 /* End XCBuildConfiguration section */ 294 434 … … 312 452 defaultConfigurationName = Release; 313 453 }; 454 8698C8740DDDBB8800294DC6 /* Build configuration list for PBXNativeTarget "UnitTest" */ = { 455 isa = XCConfigurationList; 456 buildConfigurations = ( 457 8698C8720DDDBB8700294DC6 /* Debug */, 458 8698C8730DDDBB8700294DC6 /* Release */, 459 ); 460 defaultConfigurationIsVisible = 0; 461 defaultConfigurationName = Release; 462 }; 314 463 /* End XCConfigurationList section */ 315 464 }; -
lang/objective-c/HatebuCoreData/HatebuCoreData_AppDelegate.m
r11706 r11714 19 19 */ 20 20 - (NSString *)applicationSupportFolder { 21 21 22 22 NSArray *paths = NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory, NSUserDomainMask, YES); 23 23 NSString *basePath = ([paths count] > 0) ? [paths objectAtIndex:0] : NSTemporaryDirectory(); … … 30 30 */ 31 31 - (NSManagedObjectModel *)managedObjectModel { 32 32 33 33 if (managedObjectModel != nil) { 34 34 return managedObjectModel; 35 35 } 36 36 37 37 managedObjectModel = [[NSManagedObjectModel mergedModelFromBundles:nil] retain]; 38 38 return managedObjectModel; … … 47 47 */ 48 48 - (NSPersistentStoreCoordinator *) persistentStoreCoordinator { 49 49 50 50 if (persistentStoreCoordinator != nil) { 51 51 return persistentStoreCoordinator; 52 52 } 53 53 54 54 NSFileManager *fileManager; 55 55 NSString *applicationSupportFolder = nil; … … 68 68 [[NSApplication sharedApplication] presentError:error]; 69 69 } 70 70 71 71 return persistentStoreCoordinator; 72 72 } … … 77 77 */ 78 78 - (NSManagedObjectContext *) managedObjectContext { 79 79 80 80 if (managedObjectContext != nil) { 81 81 return managedObjectContext; 82 82 } 83 83 84 84 NSPersistentStoreCoordinator *coordinator = [self persistentStoreCoordinator]; 85 85 if (coordinator != nil) { … … 105 105 */ 106 106 - (IBAction) saveAction:(id)sender { 107 107 108 108 NSError *error = nil; 109 109 if (![[self managedObjectContext] save:&error]) { … … 119 119 */ 120 120 - (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication *)sender { 121 121 122 122 NSError *error; 123 123 int reply = NSTerminateNow; … … 126 126 if ([managedObjectContext commitEditing]) { 127 127 if ([managedObjectContext hasChanges] && ![managedObjectContext save:&error]) { 128 128 129 129 // This error handling simply presents error information in a panel with an 130 130 // "Ok" button, which does not include any attempt at error recovery (meaning, … … 132 132 // present the information to the user and then follow up with a panel asking 133 133 // if the user wishes to "Quit Anyway", without saving the changes. 134 134 135 135 // Typically, this process should be altered to include application-specific 136 136 // recovery steps. 137 137 138 138 BOOL errorResult = [[NSApplication sharedApplication] presentError:error]; 139 139 140 140 if (errorResult == YES) { 141 141 reply = NSTerminateCancel; 142 142 } 143 143 144 144 else { 145 145 146 146 int alertReturn = NSRunAlertPanel(nil, @"Could not save changes while quitting. Quit anyway?" , @"Quit anyway", @"Cancel", nil); 147 147 if (alertReturn == NSAlertAlternateReturn) { 148 reply = NSTerminateCancel; 148 reply = NSTerminateCancel; 149 149 } 150 150 } 151 151 } 152 152 } 153 154 153 else { 155 154 reply = NSTerminateCancel; 156 155 } 157 156 } 158 157 159 158 return reply; 160 159 } … … 172 171 173 172 - (void)addEntry:(NSXMLElement *)entry { 174 NSManagedObject *bmk = [NSEntityDescription173 NSManagedObject *bmk = [NSEntityDescription 175 174 insertNewObjectForEntityForName:@"Bookmark" 176 175 inManagedObjectContext:[self managedObjectContext]]; 177 178 NSString *title = [[[entry elementsForName: @"title"] objectAtIndex:0] stringValue];179 NSLog(@"title = %@", title);180 [bmk setValue:title forKey:@"title"];181 182 NSArray *urls = [entry elementsForName:@"link"];183 for (NSXMLElement *url in urls) {184 if ([[[url attributeForName:@"rel"] stringValue] compare:@"related"]) {185 NSString *siteUrl = [[url attributeForName:@"href"] stringValue];186 NSLog(@"siteUrl = %@", siteUrl);187 [bmk setValue:siteUrl forKey:@"siteUrl"];188 } else {189 NSString *bookmarkUrl = [[url attributeForName:@"href"] stringValue];190 NSLog(@"bookmarkUrl = %@", bookmarkUrl);191 [bmk setValue:bookmarkUrl forKey:@"bookmarkUrl"];192 }193 }194 195 NSString *issued = [[[entry elementsForName: @"issued"] objectAtIndex:0] stringValue];196 issued = [issued stringByReplacingOccurrencesOfString:@"T" withString:@" "];197 issued = [issued stringByReplacingOccurrencesOfString:@"+" withString:@" +"];198 // issued = [issued stringByReplacingOccurrencesOfString:@"-" withString:@" -"]; // XXX BUG: won't work outside of Japan (Timezone +09:00)199 NSDate *date = [NSDate dateWithString:issued];200 NSLog(@"issued: %@", issued);201 [bmk setValue:date forKey:@"issued"];202 NSString *body = [[[entry elementsForName: @"summary"] objectAtIndex:0] stringValue];203 NSLog(@"body: %@", body);204 [bmk setValue:body forKey:@"body"];205 206 NSMutableSet *tag_set = [[NSMutableSet alloc] init];207 NSLog(@"tag_set: %@", tag_set);208 NSArray *tags = [entry elementsForName:@"dc:subject"];209 NSLog(@"tags: %@", tags);210 211 for (NSXMLElement *t in tags) {212 NSString *name = [t stringValue];213 214 NSPredicate *pred = [NSPredicate predicateWithFormat:@"name == %@", name];215 NSEntityDescription *entity = [NSEntityDescription entityForName:@"Tag" inManagedObjectContext:[self managedObjectContext]];216 217 NSFetchRequest *request = [[[NSFetchRequest alloc] init] autorelease];218 [request setEntity:entity];219 [request setPredicate:pred];220 221 NSManagedObject *tag;222 223 if (0 < [[self managedObjectContext] countForFetchRequest:request error:nil]) { // tag already exists224 NSArray *arr = [[self managedObjectContext] executeFetchRequest:request error:nil];225 tag = [arr objectAtIndex:0];226 } else {227 tag = [NSEntityDescription insertNewObjectForEntityForName:@"Tag" inManagedObjectContext:[self managedObjectContext]];228 [tag setValue:name forKey:@"name"];229 }230 [tag_set addObject:tag];231 NSLog(@"added: %@", tag);232 }233 [bmk setValue:tag_set forKey:@"tags"];176 177 NSString *title = [[[entry elementsForName: @"title"] objectAtIndex:0] stringValue]; 178 NSLog(@"title = %@", title); 179 [bmk setValue:title forKey:@"title"]; 180 181 NSArray *urls = [entry elementsForName:@"link"]; 182 for (NSXMLElement *url in urls) { 183 if ([[[url attributeForName:@"rel"] stringValue] compare:@"related"]) { 184 NSString *siteUrl = [[url attributeForName:@"href"] stringValue]; 185 NSLog(@"siteUrl = %@", siteUrl); 186 [bmk setValue:siteUrl forKey:@"siteUrl"]; 187 } else { 188 NSString *bookmarkUrl = [[url attributeForName:@"href"] stringValue]; 189 NSLog(@"bookmarkUrl = %@", bookmarkUrl); 190 [bmk setValue:bookmarkUrl forKey:@"bookmarkUrl"]; 191 } 192 } 193 194 NSString *issued = [[[entry elementsForName: @"issued"] objectAtIndex:0] stringValue]; 195 issued = [issued stringByReplacingOccurrencesOfString:@"T" withString:@" "]; 196 issued = [issued stringByReplacingOccurrencesOfString:@"+" withString:@" +"]; 197 // issued = [issued stringByReplacingOccurrencesOfString:@"-" withString:@" -"]; // XXX BUG: won't work outside of Japan (Timezone +09:00) 198 NSDate *date = [NSDate dateWithString:issued]; 199 NSLog(@"issued: %@", issued); 200 [bmk setValue:date forKey:@"issued"]; 201 NSString *body = [[[entry elementsForName: @"summary"] objectAtIndex:0] stringValue]; 202 NSLog(@"body: %@", body); 203 [bmk setValue:body forKey:@"body"]; 204 205 NSMutableSet *tag_set = [[NSMutableSet alloc] init]; 206 NSLog(@"tag_set: %@", tag_set); 207 NSArray *tags = [entry elementsForName:@"dc:subject"]; 208 NSLog(@"tags: %@", tags); 209 210 for (NSXMLElement *t in tags) { 211 NSString *name = [t stringValue]; 212 213 NSPredicate *pred = [NSPredicate predicateWithFormat:@"name == %@", name]; 214 NSEntityDescription *entity = [NSEntityDescription entityForName:@"Tag" inManagedObjectContext:[self managedObjectContext]]; 215 216 NSFetchRequest *request = [[[NSFetchRequest alloc] init] autorelease]; 217 [request setEntity:entity]; 218 [request setPredicate:pred]; 219 220 NSManagedObject *tag; 221 222 if (0 < [[self managedObjectContext] countForFetchRequest:request error:nil]) { // tag already exists 223 NSArray *arr = [[self managedObjectContext] executeFetchRequest:request error:nil]; 224
![(please configure the [header_logo] section in trac.ini)](/share/chrome/site/your_project_logo.png)