Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

austospumanto

macrumors newbie
Original poster
So I've been messing with facebook connect for about 10 hours now, and I still am not able to send a query using fql to Facebook and get back anything let alone keep my app from crashing. Basically, when I try to log in, it never calls the session:didLogin: function, where I'm trying to send my query from. And when I try to send it manually, the console says:

2010-01-19 22:44:49.821 Facebook[3396:207] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[NSCFDictionary setObject:forKey:]: attempt to insert nil value (key: session_key)'
2010-01-19 22:44:49.823 Facebook[3396:207] Stack (
29373531,
2446402825,
29457467,
29457306,
162565,
23131,
9411,
2802777,
3210146,
3218883,
3214095,
2907699,
2816028,
2842805,
37469905,
29158272,
29154376,
37463949,
37464146,
2846723,
8516,
8370
)

PLEASE HELP ME!!!!!!!! I've provided my source files below.

Here's my header:

//
// FacebookViewController.h
// Facebook
//
// Created by Austin on 1/19/10.
// Copyright Dunham Academy 2010. All rights reserved.
//

#import <UIKit/UIKit.h>
#import "FBConnect/FBConnect.h"

@interface FacebookViewController : UIViewController <FBSessionDelegate, FBRequestDelegate> {
FBSession *session;
}
//method called when I press button on screen
-(IBAction)Query;

@end





Here's my implementation:

//
// FacebookViewController.m
// Facebook
//
// Created by Austin on 1/19/10.
// Copyright Dunham Academy 2010. All rights reserved.
//

#import "FacebookViewController.h"
#import "FBConnect/FBSession.h"

@implementation FacebookViewController



/*
// The designated initializer. Override to perform setup that is required before the view is loaded.
- (id)initWithNibName🙁NSString *)nibNameOrNil bundle🙁NSBundle *)nibBundleOrNil {
if (self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]) {
// Custom initialization
}
return self;
}
*/

/*
// Implement loadView to create a view hierarchy programmatically, without using a nib.
- (void)loadView {
}
*/


// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad {
[super viewDidLoad];
session = [[FBSession sessionForApplication😡"Actual API KEY" secret😡"Actual Secret Key" delegate:self] retain];
FBLoginButton* button = [[[FBLoginButton alloc] init] autorelease];
[self.view addSubview:button];
}

-(IBAction)Query {
NSString* fql = [NSString stringWithFormat😡"select uid,name from user where uid == %lld", aVariableForMyUserIDWhichIKnow];
NSDictionary* params = [NSDictionary dictionaryWithObject:fql forKey😡"query"];
[[FBRequest requestWithDelegate:self] call😡"facebook.fql.query" params😛arams];

}

- (void)request🙁FBRequest*)request didLoad🙁id)result {

NSLog(@"awesome");
}

- (void)request🙁FBRequest*)request didFailWithError🙁NSError*)error {

}

- (void)session🙁FBSession*)session didLogin🙁FBUID)uid {
//This NSLog has never gotten displayed, which means this function has never been called... weird
NSLog(@"hi");
NSString* fql = [NSString stringWithFormat😡"select uid,name from user where uid == %lld", uid];
NSDictionary* params = [NSDictionary dictionaryWithObject:fql forKey😡"query"];
[[FBRequest requestWithDelegate:self] call😡"facebook.fql.query" params😛arams];
}

- (void)didReceiveMemoryWarning {
// Releases the view if it doesn't have a superview.
[super didReceiveMemoryWarning];

// Release any cached data, images, etc that aren't in use.
}

- (void)viewDidUnload {
[session logout];
// Release any retained subviews of the main view.
// e.g. self.myOutlet = nil;
}


- (void)dealloc {
[super dealloc];
[session.delegates removeObject: self];
[session release], session = nil;
}

@end
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.