Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialKevin Daniel Pantasdo
6,369 PointsAfter adding in the option:@{@"scope" : @[@"likes"]} into the simpleAuth, it is still showing error 400, what to do?
if (self.accessToken == nil){ [SimpleAuth authorize:@"instagram" options:@{@"scope" : @[@"likes"]} completion:^(NSDictionary *responseObject, NSError *error) { self.accessToken = responseObject[@"credentials"][@"token"];
[userDefaults setObject:self.accessToken forKey:@"accessToken"];
[userDefaults synchronize];
[self refresh];
}];
}else{
[self refresh];
}
1 Answer
durul
62,690 Pointstry this.
- (void)viewDidLoad {
[super viewDidLoad];
self.title = @"Photo Bombers";
[self.collectionView registerClass:[THPhotoCell class] forCellWithReuseIdentifier:@"photo"];
self.collectionView.backgroundColor = [UIColor whiteColor];
NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults];
self.accessToken = [userDefaults objectForKey:@"accessToken"];
if (self.accessToken == nil) {
[SimpleAuth authorize:@"instagram" options:@{@"scope": @[@"basic", @"comments", @"likes", @"relationships"]} completion:^(id responseObject, NSError *error) {
self.accessToken = responseObject[@"credentials"][@"token"];
[userDefaults setObject:self.accessToken forKey:@"accessToken"];
[userDefaults synchronize];
[self refresh];
}];
} else {
[self refresh];
}
}