我已经在 facebook 上创建了新的 APP ID,但我无法在 facebook 上发布照片,但是使用几个月后我创建的其他 APP ID 我可以发布它为什么会这样?APP ID需要什么权限吗?
- (void) startPosting {
spinnerView.labelText = @"Sharing";
[spinnerView startAnimating];
[self takeScreenshot];
FBRequest *request = [[[FBRequest alloc] initWithSession:FBSession.activeSession
graphPath:@"me/albums"
parameters:nil
HTTPMethod:nil] autorelease];
FBRequestConnection *newConnection = [[[FBRequestConnection alloc] init] autorelease];
//1 step - get all albums from user's profile
FBRequestHandler handler = ^(FBRequestConnection *connection, id result, NSError *error) {
if (error) {
NSLog ( @"%@", [error localizedDescription]);
[spinnerView stopAnimating];
} else {
NSDictionary *dictionary = (NSDictionary *)result;
NSArray* albums = [dictionary objectForKey:@"data"];
NSString* path = @"me/photos";
for (NSUInteger i = 0; i < [albums count]; ++i)
{
NSDictionary* album = [albums objectAtIndex:i];
NSString* albumType = [album objectForKey:@"type"];
if ([albumType isEqualToString:@"wall"])
{
// publish the image onto the wall
path = [NSString stringWithFormat:@"%@/photos", [album objectForKey:@"id"]];
break;
}
}
[self postScreenshot:path];
}
};
[newConnection addRequest:request completionHandler:handler];
[newConnection start];
}
- (void) postScreenshot:(NSString*)path {
NSMutableDictionary *parameters = [NSMutableDictionary dictionaryWithObjectsAndKeys:
screenShot, @"picture",
[NSString stringWithFormat:@"Check out this %@ chart : %@", [SurveyManager appName],((UILabel*)self.navigationItem.titleView).text], @"message",
nil];
FBRequest *request = [[[FBRequest alloc] initWithSession:FBSession.activeSession
graphPath:path
parameters:parameters
HTTPMethod:@"POST"] autorelease];
FBRequestConnection *newConnection = [[[FBRequestConnection alloc] init] autorelease];
FBRequestHandler handler = ^(FBRequestConnection *connection, id result, NSError *error) {
[spinnerView stopAnimating];
};
[newConnection addRequest:request completionHandler:handler];
[newConnection start];
}