Advertisement
Guest User

Untitled

a guest
Feb 8th, 2016
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.74 KB | None | 0 0
  1. - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
  2. {
  3. [QBSettings setApplicationID:kApplicationID];
  4. [QBSettings setAuthKey:kAuthKey];
  5. [QBSettings setAuthSecret:kAuthSecret];
  6. [QBSettings setAccountKey:kAcconuntKey];
  7.  
  8. [[GeoDataManager instance] fetchLatestCheckIns];
  9.  
  10. return YES;
  11. }
  12.  
  13. @implementation GeoDataManager
  14.  
  15. + (instancetype)instance
  16. {
  17. static GeoDataManager *instance = nil;
  18. static dispatch_once_t onceToken;
  19.  
  20. dispatch_once(&onceToken, ^{
  21. instance = [self new];
  22. });
  23.  
  24. return instance;
  25. }
  26.  
  27. - (void)fetchLatestCheckIns
  28. {
  29. QBLGeoDataFilter* filter = [QBLGeoDataFilter new];
  30. filter.lastOnly = YES;
  31. filter.sortBy = GeoDataSortByKindCreatedAt;
  32.  
  33. QBGeneralResponsePage *page = [QBGeneralResponsePage responsePageWithCurrentPage:1 perPage:70];
  34.  
  35. [QBRequest geoDataWithFilter:filter page:page successBlock:^(QBResponse *response, NSArray *objects, QBGeneralResponsePage *page) {
  36. [[DataManager sharedDataManager] saveCheckIns:objects];
  37. } errorBlock:^(QBResponse *response) {
  38.  
  39. NSLog(@"Error = %@", response.error);
  40.  
  41. }];
  42. }
  43.  
  44. func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
  45.  
  46. // Set QuickBlox credentials (You must create application in admin.quickblox.com).
  47. QBSettings.setApplicationID(kQBApplicationID)
  48. QBSettings.setAuthKey(kQBAuthKey)
  49. QBSettings.setAuthSecret(kQBAuthSecret)
  50. QBSettings.setAccountKey(kQBAccountKey)
  51.  
  52. GeoDataManager .instance().fetchLatestCheckIns()
  53.  
  54. return true
  55. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement