Mac用艦これ専用ブラウザ おまけ機能付き
Revisão | 9df657baa888229f93ea0ce4e0b994b22c8c20d6 (tree) |
---|---|
Hora | 2015-01-04 17:23:16 |
Autor | masakih <masakih@user...> |
Commiter | masakih |
MOD Primitiveなメソッドだけを使用するように変更
HMCoreDataManagerクラスをSwiftに書き換えるための下準備
@@ -22,8 +22,9 @@ | ||
22 | 22 | for(NSDictionary *updataInfo in shipInfos) { |
23 | 23 | NSError *error = nil; |
24 | 24 | NSArray *array = [store objectsWithEntityName:@"Ship" |
25 | - error:&error | |
26 | - predicateFormat:@"id = %@", @([updataInfo[@"api_id"] integerValue])]; | |
25 | + sortDescriptors:nil | |
26 | + predicate:[NSPredicate predicateWithFormat:@"id = %@", @([updataInfo[@"api_id"] integerValue])] | |
27 | + error:&error]; | |
27 | 28 | if(array.count == 0) { |
28 | 29 | if(error) { |
29 | 30 | NSLog(@"Error: at %@ : %@", NSStringFromClass([self class]), error); |
@@ -40,8 +40,9 @@ typedef NS_ENUM(NSUInteger, HMBattleType) { | ||
40 | 40 | |
41 | 41 | NSError *error = nil; |
42 | 42 | NSArray *array = [self.store objectsWithEntityName:@"Battle" |
43 | - predicate:nil | |
44 | - error:&error]; | |
43 | + sortDescriptors:nil | |
44 | + predicate:nil | |
45 | + error:&error]; | |
45 | 46 | if(error) { |
46 | 47 | [self log:@"%s error: %@", __PRETTY_FUNCTION__, error]; |
47 | 48 | return; |
@@ -59,8 +60,9 @@ typedef NS_ENUM(NSUInteger, HMBattleType) { | ||
59 | 60 | |
60 | 61 | NSError *error = nil; |
61 | 62 | NSArray *array = [self.store objectsWithEntityName:@"Damage" |
62 | - predicate:nil | |
63 | - error:&error]; | |
63 | + sortDescriptors:nil | |
64 | + predicate:nil | |
65 | + error:&error]; | |
64 | 66 | if(error) { |
65 | 67 | [self log:@"%s error: %@", __PRETTY_FUNCTION__, error]; |
66 | 68 | return; |
@@ -107,6 +109,7 @@ typedef NS_ENUM(NSUInteger, HMBattleType) { | ||
107 | 109 | // Battleエンティティ取得 |
108 | 110 | error = nil; |
109 | 111 | NSArray *battles = [self.store objectsWithEntityName:@"Battle" |
112 | + sortDescriptors:nil | |
110 | 113 | predicate:nil |
111 | 114 | error:&error]; |
112 | 115 | if(error) { |
@@ -301,8 +304,9 @@ typedef NS_ENUM(NSUInteger, HMBattleType) { | ||
301 | 304 | |
302 | 305 | error = nil; |
303 | 306 | NSArray *array = [self.store objectsWithEntityName:@"Battle" |
304 | - predicate:nil | |
305 | - error:&error]; | |
307 | + sortDescriptors:nil | |
308 | + predicate:nil | |
309 | + error:&error]; | |
306 | 310 | if(error) { |
307 | 311 | [self log:@"%s error: %@", __PRETTY_FUNCTION__, error]; |
308 | 312 | return; |
@@ -319,6 +323,7 @@ typedef NS_ENUM(NSUInteger, HMBattleType) { | ||
319 | 323 | // 艦隊メンバーを取得 |
320 | 324 | error = nil; |
321 | 325 | NSArray *decks = [serverStore objectsWithEntityName:@"Deck" |
326 | + sortDescriptors:nil | |
322 | 327 | predicate:predicate |
323 | 328 | error:&error]; |
324 | 329 | if(error) { |
@@ -343,8 +348,9 @@ typedef NS_ENUM(NSUInteger, HMBattleType) { | ||
343 | 348 | for(id shipId in shipIds) { |
344 | 349 | error = nil; |
345 | 350 | NSArray *ship = [serverStore objectsWithEntityName:@"Ship" |
346 | - error:&error | |
347 | - predicateFormat:@"id = %@", @([shipId integerValue])]; | |
351 | + sortDescriptors:nil | |
352 | + predicate:[NSPredicate predicateWithFormat:@"id = %@", @([shipId integerValue])] | |
353 | + error:&error]; | |
348 | 354 | if(error) { |
349 | 355 | [self log:@"%s error: %@", __PRETTY_FUNCTION__, error]; |
350 | 356 | } |
@@ -66,6 +66,7 @@ | ||
66 | 66 | { |
67 | 67 | NSError *error = nil; |
68 | 68 | NSArray *decks = [self.store objectsWithEntityName:@"Deck" |
69 | + sortDescriptors:nil | |
69 | 70 | predicate:nil |
70 | 71 | error:&error]; |
71 | 72 | // TODO: error handling |
@@ -95,8 +96,9 @@ | ||
95 | 96 | |
96 | 97 | NSError *error = nil; |
97 | 98 | NSArray *decks = [self.store objectsWithEntityName:@"Deck" |
98 | - error:&error | |
99 | - predicateFormat:@"id = %ld", deckNumber]; | |
99 | + sortDescriptors:nil | |
100 | + predicate:[NSPredicate predicateWithFormat:@"id = %ld", deckNumber] | |
101 | + error:&error]; | |
100 | 102 | // TODO: error handling |
101 | 103 | id deck = decks[0]; |
102 | 104 |
@@ -34,8 +34,9 @@ | ||
34 | 34 | dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ |
35 | 35 | HMServerDataStore *serverDataStore = [HMServerDataStore oneTimeEditor]; |
36 | 36 | NSArray *array = [serverDataStore objectsWithEntityName:@"KenzoDock" |
37 | - error:NULL | |
38 | - predicateFormat:@"id = %@", @([[self.arguments valueForKey:@"api_kdock_id"] integerValue])]; | |
37 | + sortDescriptors:nil | |
38 | + predicate:[NSPredicate predicateWithFormat:@"id = %@", @([[self.arguments valueForKey:@"api_kdock_id"] integerValue])] | |
39 | + error:NULL]; | |
39 | 40 | if([array count] == 0) { |
40 | 41 | NSLog(@"KenzoDock data is invalid."); |
41 | 42 | return; |
@@ -45,14 +46,20 @@ | ||
45 | 46 | NSNumber *item1 = [kdock valueForKey:@"item1"]; |
46 | 47 | |
47 | 48 | // Deck -> FlagShip |
48 | - array = [serverDataStore objectsWithEntityName:@"Deck" error:NULL predicateFormat:@"id = 1"]; | |
49 | + array = [serverDataStore objectsWithEntityName:@"Deck" | |
50 | + sortDescriptors:nil | |
51 | + predicate:[NSPredicate predicateWithFormat:@"id = 1"] | |
52 | + error:NULL]; | |
49 | 53 | if([array count] == 0) { |
50 | 54 | NSLog(@"Deck data is invalid."); |
51 | 55 | return; |
52 | 56 | } |
53 | 57 | id deck = array[0]; |
54 | 58 | id flagShipID = [deck valueForKey:@"ship_0"]; |
55 | - array = [serverDataStore objectsWithEntityName:@"Ship" error:NULL predicateFormat:@"id = %@", flagShipID]; | |
59 | + array = [serverDataStore objectsWithEntityName:@"Ship" | |
60 | + sortDescriptors:nil | |
61 | + predicate:[NSPredicate predicateWithFormat:@"id = %@", flagShipID] | |
62 | + error:NULL]; | |
56 | 63 | if([array count] == 0) { |
57 | 64 | NSLog(@"Ship data is invalid or ship_0 is invalid."); |
58 | 65 | return; |
@@ -62,7 +69,10 @@ | ||
62 | 69 | NSString *flagShipName = [flagShip valueForKeyPath:@"master_ship.name"]; |
63 | 70 | |
64 | 71 | // Basic -> level |
65 | - array = [serverDataStore objectsWithEntityName:@"Basic" predicate:nil error:NULL]; | |
72 | + array = [serverDataStore objectsWithEntityName:@"Basic" | |
73 | + sortDescriptors:nil | |
74 | + predicate:nil | |
75 | + error:NULL]; | |
66 | 76 | if([array count] == 0) { |
67 | 77 | NSLog(@"Basic data is invalid."); |
68 | 78 | return; |
@@ -73,8 +83,9 @@ | ||
73 | 83 | HMLocalDataStore *lds = [HMLocalDataStore oneTimeEditor]; |
74 | 84 | HMKenzoMark *newObejct = nil; |
75 | 85 | array = [lds objectsWithEntityName:@"KenzoMark" |
76 | - error:NULL | |
77 | - predicateFormat:@"kDockId = %@", @([[self.arguments valueForKey:@"api_kdock_id"] integerValue])]; | |
86 | + sortDescriptors:nil | |
87 | + predicate:[NSPredicate predicateWithFormat:@"kDockId = %@", @([[self.arguments valueForKey:@"api_kdock_id"] integerValue])] | |
88 | + error:NULL]; | |
78 | 89 | if([array count] == 0) { |
79 | 90 | newObejct = [NSEntityDescription insertNewObjectForEntityForName:@"KenzoMark" |
80 | 91 | inManagedObjectContext:[lds managedObjectContext]]; |
@@ -40,8 +40,9 @@ | ||
40 | 40 | |
41 | 41 | NSError *error = nil; |
42 | 42 | NSArray *array = [store objectsWithEntityName:@"SlotItem" |
43 | - error:&error | |
44 | - predicateFormat:@"id IN %@", items]; | |
43 | + sortDescriptors:nil | |
44 | + predicate:[NSPredicate predicateWithFormat:@"id IN %@", items] | |
45 | + error:&error]; | |
45 | 46 | if([array count] == 0) { |
46 | 47 | NSLog(@"SlotItem is invalid."); |
47 | 48 | return; |
@@ -53,7 +54,10 @@ | ||
53 | 54 | |
54 | 55 | // |
55 | 56 | error = nil; |
56 | - array = [store objectsWithEntityName:@"Material" predicate:nil error:&error]; | |
57 | + array = [store objectsWithEntityName:@"Material" | |
58 | + sortDescriptors:nil | |
59 | + predicate:nil | |
60 | + error:&error]; | |
57 | 61 | if(error) { |
58 | 62 | [self log:@"Fetch error: %@", error]; |
59 | 63 | return; |
@@ -104,8 +104,9 @@ | ||
104 | 104 | NSArray *array = nil; |
105 | 105 | if(shipId != -1) { |
106 | 106 | array = [store objectsWithEntityName:@"Ship" |
107 | - error:&error | |
108 | - predicateFormat:@"id = %ld", shipId]; | |
107 | + sortDescriptors:nil | |
108 | + predicate:[NSPredicate predicateWithFormat:@"id = %ld", shipId] | |
109 | + error:&error]; | |
109 | 110 | } |
110 | 111 | if(shipId != -1 && array.count == 0) { |
111 | 112 | NSLog(@"Could not found ship of id %@", shipIdNumber); |
@@ -235,8 +236,9 @@ | ||
235 | 236 | NSArray *array = nil; |
236 | 237 | if(shipId != -1) { |
237 | 238 | array = [store objectsWithEntityName:@"Ship" |
238 | - error:&error | |
239 | - predicateFormat:@"id = %ld", shipId]; | |
239 | + sortDescriptors:nil | |
240 | + predicate:[NSPredicate predicateWithFormat:@"id = %ld", shipId] | |
241 | + error:&error]; | |
240 | 242 | } else { |
241 | 243 | return 0; |
242 | 244 | } |
@@ -277,8 +279,9 @@ | ||
277 | 279 | if(itemId.integerValue == -1) break; |
278 | 280 | error = nil; |
279 | 281 | array = [store objectsWithEntityName:@"SlotItem" |
280 | - error:&error | |
281 | - predicateFormat:@"id = %@", itemId]; | |
282 | + sortDescriptors:nil | |
283 | + predicate:[NSPredicate predicateWithFormat:@"id = %@", itemId] | |
284 | + error:&error]; | |
282 | 285 | if(array.count == 0) continue; |
283 | 286 | HMKCSlotItemObject *slotItem = array[0]; |
284 | 287 | HMKCMasterSlotItemObject *master = slotItem.master_slotItem; |
@@ -336,8 +339,9 @@ | ||
336 | 339 | NSArray *array = nil; |
337 | 340 | if(shipId != -1) { |
338 | 341 | array = [store objectsWithEntityName:@"Ship" |
339 | - error:&error | |
340 | - predicateFormat:@"id = %ld", shipId]; | |
342 | + sortDescriptors:nil | |
343 | + predicate:[NSPredicate predicateWithFormat:@"id = %ld", shipId] | |
344 | + error:&error]; | |
341 | 345 | } |
342 | 346 | if(array.count == 0) { |
343 | 347 | NSLog(@"Could not found ship of id %@", shipIdNumber); |
@@ -36,8 +36,9 @@ | ||
36 | 36 | HMServerDataStore *serverDataStore = [HMServerDataStore oneTimeEditor]; |
37 | 37 | NSError *error = nil; |
38 | 38 | NSArray *result = [serverDataStore objectsWithEntityName:@"SlotItem" |
39 | - error:&error | |
40 | - predicateFormat:@"id = %ld", [slotitemId integerValue]]; | |
39 | + sortDescriptors:nil | |
40 | + predicate:[NSPredicate predicateWithFormat:@"id = %ld", [slotitemId integerValue]] | |
41 | + error:&error]; | |
41 | 42 | if(error) { |
42 | 43 | [self log:@"Fetch error: %@", error]; |
43 | 44 | return; |
@@ -18,8 +18,9 @@ | ||
18 | 18 | { |
19 | 19 | HMServerDataStore *serverDataStore = [HMServerDataStore oneTimeEditor]; |
20 | 20 | NSArray *array = [serverDataStore objectsWithEntityName:@"KenzoDock" |
21 | - error:NULL | |
22 | - predicateFormat:@"id = %@", @([[self.arguments valueForKey:@"api_kdock_id"] integerValue])]; | |
21 | + sortDescriptors:nil | |
22 | + predicate:[NSPredicate predicateWithFormat:@"id = %@", @([[self.arguments valueForKey:@"api_kdock_id"] integerValue])] | |
23 | + error:NULL]; | |
23 | 24 | if([array count] == 0) { |
24 | 25 | NSLog(@"KenzoDock data is invalid."); |
25 | 26 | return; |
@@ -29,7 +30,10 @@ | ||
29 | 30 | NSNumber *item1 = [kdock valueForKey:@"item1"]; |
30 | 31 | |
31 | 32 | // |
32 | - array = [serverDataStore objectsWithEntityName:@"MasterShip" error:NULL predicateFormat:@"id = %@", [kdock valueForKey:@"created_ship_id"]]; | |
33 | + array = [serverDataStore objectsWithEntityName:@"MasterShip" | |
34 | + sortDescriptors:nil | |
35 | + predicate:[NSPredicate predicateWithFormat:@"id = %@", [kdock valueForKey:@"created_ship_id"]] | |
36 | + error:NULL]; | |
33 | 37 | if([array count] == 0) { |
34 | 38 | NSLog(@"MasterShip data is invalid or ship_id is invalid."); |
35 | 39 | return; |
@@ -41,12 +45,19 @@ | ||
41 | 45 | NSString *flafShipName = nil; |
42 | 46 | NSNumber *commanderLv = nil; |
43 | 47 | HMLocalDataStore *localDataStore = [HMLocalDataStore oneTimeEditor]; |
48 | + NSPredicate *predicate = [NSPredicate predicateWithFormat: | |
49 | + @"fuel = %@ AND bull = %@ AND steel = %@ AND bauxite = %@ AND kaihatusizai = %@ AND kDockId = %@ AND created_ship_id = %@", | |
50 | + item1, | |
51 | + [kdock valueForKey:@"item2"], | |
52 | + [kdock valueForKey:@"item3"], | |
53 | + [kdock valueForKey:@"item4"], | |
54 | + [kdock valueForKey:@"item5"], | |
55 | + @([[self.arguments valueForKey:@"api_kdock_id"] integerValue]), | |
56 | + [kdock valueForKey:@"created_ship_id"]]; | |
44 | 57 | array = [localDataStore objectsWithEntityName:@"KenzoMark" |
45 | - error:NULL | |
46 | - predicateFormat:@"fuel = %@ AND bull = %@ AND steel = %@ AND bauxite = %@ AND kaihatusizai = %@ AND kDockId = %@ AND created_ship_id = %@", | |
47 | - item1, [kdock valueForKey:@"item2"], [kdock valueForKey:@"item3"], [kdock valueForKey:@"item4"], [kdock valueForKey:@"item5"], | |
48 | - @([[self.arguments valueForKey:@"api_kdock_id"] integerValue]), [kdock valueForKey:@"created_ship_id"] | |
49 | - ]; | |
58 | + sortDescriptors:nil | |
59 | + predicate:predicate | |
60 | + error:NULL]; | |
50 | 61 | if([array count] != 0) { |
51 | 62 | flagShipLv = [array[0] valueForKey:@"flagShipLv"]; |
52 | 63 | flafShipName = [array[0] valueForKey:@"flagShipName"]; |
@@ -36,7 +36,10 @@ | ||
36 | 36 | NSManagedObjectContext *managedObjectContext = [serverDataStore managedObjectContext]; |
37 | 37 | |
38 | 38 | NSError *error = nil; |
39 | - id result = [serverDataStore objectsWithEntityName:@"Basic" predicate:nil error:&error]; | |
39 | + id result = [serverDataStore objectsWithEntityName:@"Basic" | |
40 | + sortDescriptors:nil | |
41 | + predicate:nil | |
42 | + error:&error]; | |
40 | 43 | if(error) { |
41 | 44 | [self log:@"Fetch error: %@", error]; |
42 | 45 | return; |
@@ -50,7 +50,10 @@ | ||
50 | 50 | NSManagedObjectContext *managedObjectContext = [serverDataStore managedObjectContext]; |
51 | 51 | |
52 | 52 | NSError *error = nil; |
53 | - id result = [serverDataStore objectsWithEntityName:@"Material" predicate:nil error:&error]; | |
53 | + id result = [serverDataStore objectsWithEntityName:@"Material" | |
54 | + sortDescriptors:nil | |
55 | + predicate:nil | |
56 | + error:&error]; | |
54 | 57 | if(error) { |
55 | 58 | [self log:@"Fetch error: %@", error]; |
56 | 59 | return; |
@@ -34,8 +34,9 @@ | ||
34 | 34 | |
35 | 35 | NSError *error = nil; |
36 | 36 | NSArray *array = [store objectsWithEntityName:@"NyukyoDock" |
37 | - error:&error | |
38 | - predicateFormat:@"id = %@", @([ndockId integerValue])]; | |
37 | + sortDescriptors:nil | |
38 | + predicate:[NSPredicate predicateWithFormat:@"id = %@", @([ndockId integerValue])] | |
39 | + error:&error]; | |
39 | 40 | if(array.count == 0) { |
40 | 41 | if(error) { |
41 | 42 | NSLog(@"Error: at %@ : %@", NSStringFromClass([self class]), error); |
@@ -54,8 +55,9 @@ | ||
54 | 55 | // 艦隊リスト更新用 |
55 | 56 | error = nil; |
56 | 57 | array = [store objectsWithEntityName:@"Ship" |
57 | - error:&error | |
58 | - predicateFormat:@"id = %@", @([shipId integerValue])]; | |
58 | + sortDescriptors:nil | |
59 | + predicate:[NSPredicate predicateWithFormat:@"id = %@", @([shipId integerValue])] | |
60 | + error:&error]; | |
59 | 61 | if(array.count == 0) { |
60 | 62 | if(error) { |
61 | 63 | NSLog(@"Error: at %@ : %@", NSStringFromClass([self class]), error); |
@@ -39,8 +39,9 @@ | ||
39 | 39 | |
40 | 40 | NSError *error = nil; |
41 | 41 | NSArray *array = [store objectsWithEntityName:@"Ship" |
42 | - error:&error | |
43 | - predicateFormat:@"id = %@", @([shipId integerValue])]; | |
42 | + sortDescriptors:nil | |
43 | + predicate:[NSPredicate predicateWithFormat:@"id = %@", @([shipId integerValue])] | |
44 | + error:&error]; | |
44 | 45 | if(array.count == 0) { |
45 | 46 | if(error) { |
46 | 47 | NSLog(@"Error: at %@ : %@", NSStringFromClass([self class]), error); |
@@ -35,8 +35,9 @@ | ||
35 | 35 | for(NSString *shipId in usedShipStringArray) { |
36 | 36 | NSError *error = nil; |
37 | 37 | NSArray *ships = [store objectsWithEntityName:@"Ship" |
38 | - error:&error | |
39 | - predicateFormat:@"id = %@", @([shipId integerValue])]; | |
38 | + sortDescriptors:nil | |
39 | + predicate:[NSPredicate predicateWithFormat:@"id = %@", @([shipId integerValue])] | |
40 | + error:&error]; | |
40 | 41 | if(ships.count == 0) { |
41 | 42 | continue; |
42 | 43 | } |
@@ -20,8 +20,9 @@ | ||
20 | 20 | |
21 | 21 | NSError *error = nil; |
22 | 22 | NSArray *ships = [store objectsWithEntityName:@"Ship" |
23 | - error:&error | |
24 | - predicateFormat:@"id = %@", @([destroyedShipId integerValue])]; | |
23 | + sortDescriptors:nil | |
24 | + predicate:[NSPredicate predicateWithFormat:@"id = %@", @([destroyedShipId integerValue])] | |
25 | + error:&error]; | |
25 | 26 | if(ships.count == 0) { |
26 | 27 | return; |
27 | 28 | } |
@@ -31,8 +31,9 @@ | ||
31 | 31 | HMServerDataStore *serverDataStore = [HMServerDataStore oneTimeEditor]; |
32 | 32 | NSError *error = nil; |
33 | 33 | NSArray *result = [serverDataStore objectsWithEntityName:@"SlotItem" |
34 | - error:&error | |
35 | - predicateFormat:@"id = %ld", [slotitemId integerValue]]; | |
34 | + sortDescriptors:nil | |
35 | + predicate:[NSPredicate predicateWithFormat:@"id = %ld", [slotitemId integerValue]] | |
36 | + error:&error]; | |
36 | 37 | if(error) { |
37 | 38 | [self log:@"Fetch error: %@", error]; |
38 | 39 | return; |
@@ -60,8 +61,9 @@ | ||
60 | 61 | { |
61 | 62 | NSError *error = nil; |
62 | 63 | NSArray *result = [serverDataStore objectsWithEntityName:@"MasterSlotItem" |
63 | - error:&error | |
64 | - predicateFormat:@"id = %ld", [slotItemId integerValue]]; | |
64 | + sortDescriptors:nil | |
65 | + predicate:[NSPredicate predicateWithFormat:@"id = %ld", [slotItemId integerValue]] | |
66 | + error:&error]; | |
65 | 67 | if(error) { |
66 | 68 | [self log:@"Fetch error: %@", error]; |
67 | 69 | return; |
@@ -19,6 +19,7 @@ | ||
19 | 19 | |
20 | 20 | NSError *error = nil; |
21 | 21 | NSArray *array = [store objectsWithEntityName:@"Battle" |
22 | + sortDescriptors:nil | |
22 | 23 | predicate:nil |
23 | 24 | error:NULL]; |
24 | 25 | if(error) { |
@@ -36,8 +36,9 @@ | ||
36 | 36 | NSError *error = nil; |
37 | 37 | |
38 | 38 | NSArray *decks = [store objectsWithEntityName:@"Deck" |
39 | - error:&error | |
40 | - predicateFormat:@"id = %@", self.missionFleetNumber]; | |
39 | + sortDescriptors:nil | |
40 | + predicate:[NSPredicate predicateWithFormat:@"id = %@", self.missionFleetNumber] | |
41 | + error:&error]; | |
41 | 42 | if(decks.count == 0) return; |
42 | 43 | id deck = decks[0]; |
43 | 44 |
@@ -24,8 +24,9 @@ | ||
24 | 24 | if(created) { |
25 | 25 | NSNumber *slotItemID = [data valueForKeyPath:@"api_slot_item.api_slotitem_id"]; |
26 | 26 | NSArray *array = [serverDataStore objectsWithEntityName:@"MasterSlotItem" |
27 | - error:NULL | |
28 | - predicateFormat:@"id = %@", slotItemID]; | |
27 | + sortDescriptors:nil | |
28 | + predicate:[NSPredicate predicateWithFormat:@"id = %@", slotItemID] | |
29 | + error:NULL]; | |
29 | 30 | if([array count] == 0) { |
30 | 31 | NSLog(@"MasterSlotItem data is invalid or api_slotitem_id is invalid."); |
31 | 32 | return; |
@@ -38,14 +39,20 @@ | ||
38 | 39 | } |
39 | 40 | |
40 | 41 | // Deck -> FlagShip |
41 | - NSArray *array = [serverDataStore objectsWithEntityName:@"Deck" error:NULL predicateFormat:@"id = 1"]; | |
42 | + NSArray *array = [serverDataStore objectsWithEntityName:@"Deck" | |
43 | + sortDescriptors:nil | |
44 | + predicate:[NSPredicate predicateWithFormat:@"id = 1"] | |
45 | + error:NULL]; | |
42 | 46 | if([array count] == 0) { |
43 | 47 | NSLog(@"Deck data is invalid."); |
44 | 48 | return; |
45 | 49 | } |
46 | 50 | id deck = array[0]; |
47 | 51 | id flagShipID = [deck valueForKey:@"ship_0"]; |
48 | - array = [serverDataStore objectsWithEntityName:@"Ship" error:NULL predicateFormat:@"id = %@", flagShipID]; | |
52 | + array = [serverDataStore objectsWithEntityName:@"Ship" | |
53 | + sortDescriptors:nil | |
54 | + predicate:[NSPredicate predicateWithFormat:@"id = %@", flagShipID] | |
55 | + error:NULL]; | |
49 | 56 | if([array count] == 0) { |
50 | 57 | NSLog(@"Ship data is invalid or ship_0 is invalid."); |
51 | 58 | return; |
@@ -55,7 +62,10 @@ | ||
55 | 62 | NSString *flagShipName = [flagShip valueForKeyPath:@"master_ship.name"]; |
56 | 63 | |
57 | 64 | // Basic -> level |
58 | - array = [serverDataStore objectsWithEntityName:@"Basic" predicate:nil error:NULL]; | |
65 | + array = [serverDataStore objectsWithEntityName:@"Basic" | |
66 | + sortDescriptors:nil | |
67 | + predicate:nil | |
68 | + error:NULL]; | |
59 | 69 | if([array count] == 0) { |
60 | 70 | NSLog(@"Basic data is invalid."); |
61 | 71 | return; |
@@ -207,8 +207,9 @@ | ||
207 | 207 | if([attr[6] isEqual:@"(null)"]) continue; |
208 | 208 | |
209 | 209 | NSArray *array = [lds objectsWithEntityName:entityName |
210 | - error:NULL | |
211 | - predicateFormat:@"date = %@", [NSDate dateWithString:attr[0]]]; | |
210 | + sortDescriptors:nil | |
211 | + predicate:[NSPredicate predicateWithFormat:@"date = %@", [NSDate dateWithString:attr[0]]] | |
212 | + error:NULL]; | |
212 | 213 | if(array.count != 0) continue; |
213 | 214 | |
214 | 215 | HMKaihatuHistory *obj = [NSEntityDescription insertNewObjectForEntityForName:entityName |
@@ -240,8 +241,9 @@ | ||
240 | 241 | if([attr[6] isEqual:@"(null)"]) continue; |
241 | 242 | |
242 | 243 | NSArray *array = [lds objectsWithEntityName:entityName |
243 | - error:NULL | |
244 | - predicateFormat:@"date = %@", [NSDate dateWithString:attr[0]]]; | |
244 | + sortDescriptors:nil | |
245 | + predicate:[NSPredicate predicateWithFormat:@"date = %@", [NSDate dateWithString:attr[0]]] | |
246 | + error:NULL]; | |
245 | 247 | if(array.count != 0) continue; |
246 | 248 | |
247 | 249 | HMKenzoHistory *obj = [NSEntityDescription insertNewObjectForEntityForName:entityName |
@@ -25,8 +25,9 @@ | ||
25 | 25 | |
26 | 26 | NSError *error = nil; |
27 | 27 | NSArray *array = [store objectsWithEntityName:@"MasterSlotItem" |
28 | - error:&error | |
29 | - predicateFormat:@"id = %@", data[@"api_slotitem_id"]]; | |
28 | + sortDescriptors:nil | |
29 | + predicate:[NSPredicate predicateWithFormat:@"id = %@", data[@"api_slotitem_id"]] | |
30 | + error:&error]; | |
30 | 31 | if([array count] == 0) { |
31 | 32 | NSLog(@"MasterSlotItem is invalid"); |
32 | 33 | return; |