Advertisement
Guest User

Untitled

a guest
Nov 24th, 2014
146
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.93 KB | None | 0 0
  1. - (void) removeObjects_at_TopoNr_from_LocationRLM :(NSUInteger)TopoNr :(NSString *)folderName :(NSString *)fileName {
  2.  
  3. RLMRealm *realm = [RLMRealm realmWithPath:[self get_TopoResultRLM_FilePath :folderName :fileName]];
  4. RLMResults *resultTopoResult = [RLMTopoResult allObjectsInRealm:realm];
  5.  
  6. NSPredicate *predicate = [NSPredicate predicateWithFormat:@"TopoNrRLM == %d", TopoNr];
  7. RLMResults *resultsTopoNr = [resultTopoResult objectsWithPredicate:predicate];
  8.  
  9. if ([resultsTopoNr count] > 0) {
  10. if (TopoNr <= (int)[resultsTopoNr count]) {
  11. [realm beginWriteTransaction];
  12. [realm deleteObject:[resultsTopoNr firstObject]];
  13. [realm commitWriteTransaction];
  14. }
  15. else {
  16. NSLog(@"Fail...trying to remove TopoResult-object with TopoNr bigger to object-count");
  17. }
  18. }
  19. else {
  20. NSLog(@"Fail...trying to remove TopoResult-object in empty Realm");
  21. }
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement