Skip to content

Commit

Permalink
Fix the issue if autobind has not occurred and the app calls +shared
Browse files Browse the repository at this point in the history
  • Loading branch information
hiddenmemory committed Jun 4, 2012
1 parent ff60851 commit 2ff4f93
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ If you want to issue a pull request to fix/clean/add that would be great.
- Setup your application in facebook as per normal with single sign on - Setup your application in facebook as per normal with single sign on
- Make sure you have setup your URL handler with the scheme `fb`APPID as this is used not only on sign on but also to automatically bind the Facebook singleton object to your APPID - Make sure you have setup your URL handler with the scheme `fb`APPID as this is used not only on sign on but also to automatically bind the Facebook singleton object to your APPID
- If you do not wish to implement the URL handlers in the app delegate, then include `FBConnect.h` in your app delegate's header file and change the parent class from `UIResponder` to `FBAppDelegate` - If you do not wish to implement the URL handlers in the app delegate, then include `FBConnect.h` in your app delegate's header file and change the parent class from `UIResponder` to `FBAppDelegate`
- Now you just need to access facebook how you want to using the `[Facebook shared]` accessor. Please note, at the moment there is an issue with autobind that if you try using `[Facebook shared]` before `applicationDidFinishLaunching:` has finished running it will be null, you can always call `[Facebook bind]` in that case (say in the `viewDidLoad` method in the root view controller) - Now you just need to access facebook how you want to using the `[Facebook shared]` accessor.


If you want examples on how to use the new API, take a look at the `Facebook+Graph.m` code. There you will find how: If you want examples on how to use the new API, take a look at the `Facebook+Graph.m` code. There you will find how:


Expand Down
2 changes: 0 additions & 2 deletions sample/Hackbook/Hackbook/HackbookAppDelegate.m
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -42,8 +42,6 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(
alpha:1.0]]; alpha:1.0]];
[navController.navigationBar setBarStyle:UIBarStyleBlackTranslucent]; [navController.navigationBar setBarStyle:UIBarStyleBlackTranslucent];
self.navigationController = navController; self.navigationController = navController;

[Facebook bind];


// Initialize API data (for views, etc.) // Initialize API data (for views, etc.)
apiData = [[DataSet alloc] init]; apiData = [[DataSet alloc] init];
Expand Down
3 changes: 3 additions & 0 deletions src/Facebook.m
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -113,6 +113,9 @@ + (void)autobind:(NSNotification*)notification {
} }
} }
+ (Facebook*)shared { + (Facebook*)shared {
if( !facebookSharedObject ) {
return [self bind];
}
return facebookSharedObject; return facebookSharedObject;
} }
+ (void)load { + (void)load {
Expand Down

0 comments on commit 2ff4f93

Please sign in to comment.