From 9392726f29ffef34230930ab4cc5aa24e491e037 Mon Sep 17 00:00:00 2001 From: Matthew Cheok Date: Wed, 11 Mar 2015 11:49:09 +0800 Subject: [PATCH] Updated for Realm 0.91 --- Realm+JSON.podspec | 4 ++-- Realm+JSON/RLMObject+JSON.m | 15 ++++++++++++--- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/Realm+JSON.podspec b/Realm+JSON.podspec index 10ddb3d..5d42d7b 100644 --- a/Realm+JSON.podspec +++ b/Realm+JSON.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'Realm+JSON' - s.version = '0.2.5' + s.version = '0.2.6' s.ios.deployment_target = '7.0' s.osx.deployment_target = '10.8' s.license = { :type => 'MIT', :file => 'LICENSE' } @@ -16,5 +16,5 @@ Pod::Spec.new do |s| s.source_files = 'Realm+JSON/*.{h,m}' s.public_header_files = 'Realm+JSON/*.h' - s.dependency 'Realm', '~> 0.90' + s.dependency 'Realm', '~> 0.91' end diff --git a/Realm+JSON/RLMObject+JSON.m b/Realm+JSON/RLMObject+JSON.m index c8b0671..7438377 100644 --- a/Realm+JSON/RLMObject+JSON.m +++ b/Realm+JSON/RLMObject+JSON.m @@ -56,12 +56,21 @@ + (RLMObjectSchema *)sharedSchema; @implementation RLMObject (JSON) +static NSInteger const kCreateBatchSize = 100; + + (NSArray *)createOrUpdateInRealm:(RLMRealm *)realm withJSONArray:(NSArray *)array { + NSInteger count = array.count; NSMutableArray *result = [NSMutableArray array]; - for (NSDictionary *dictionary in array) { - id object = [self createOrUpdateInRealm:realm withJSONDictionary:dictionary]; - [result addObject:object]; + for (NSInteger index=0; index*kCreateBatchSize