Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
- {
- [QBSettings setApplicationID:kApplicationID];
- [QBSettings setAuthKey:kAuthKey];
- [QBSettings setAuthSecret:kAuthSecret];
- [QBSettings setAccountKey:kAcconuntKey];
- [[GeoDataManager instance] fetchLatestCheckIns];
- return YES;
- }
- @implementation GeoDataManager
- + (instancetype)instance
- {
- static GeoDataManager *instance = nil;
- static dispatch_once_t onceToken;
- dispatch_once(&onceToken, ^{
- instance = [self new];
- });
- return instance;
- }
- - (void)fetchLatestCheckIns
- {
- QBLGeoDataFilter* filter = [QBLGeoDataFilter new];
- filter.lastOnly = YES;
- filter.sortBy = GeoDataSortByKindCreatedAt;
- QBGeneralResponsePage *page = [QBGeneralResponsePage responsePageWithCurrentPage:1 perPage:70];
- [QBRequest geoDataWithFilter:filter page:page successBlock:^(QBResponse *response, NSArray *objects, QBGeneralResponsePage *page) {
- [[DataManager sharedDataManager] saveCheckIns:objects];
- } errorBlock:^(QBResponse *response) {
- NSLog(@"Error = %@", response.error);
- }];
- }
- func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
- // Set QuickBlox credentials (You must create application in admin.quickblox.com).
- QBSettings.setApplicationID(kQBApplicationID)
- QBSettings.setAuthKey(kQBAuthKey)
- QBSettings.setAuthSecret(kQBAuthSecret)
- QBSettings.setAccountKey(kQBAccountKey)
- GeoDataManager .instance().fetchLatestCheckIns()
- return true
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement