Sunday, June 03, 2012

Using Facebook Graph API with NimbleKit

YOU MUST configure your application according to the SSO process defined in the Facebook iOS SDK, including, selecting the proper authentication methods:

* Native/Desktop
* Native iOS App
* iOS Bundle ID
* iPhone App Store ID
* Configured for iOS SSO (Enabled)
* iOS Native Deep Linking (Enabled)

///////////////////////////////////////////////////////////////////////////////////////////////////////////////
// MyAppDelegate.h
///////////////////////////////////////////////////////////////////////////////////////////////////////////////


///////////////////////////////////////////////////////////////////////////////////////////////////////////////
// MyAppDelegate.m
///////////////////////////////////////////////////////////////////////////////////////////////////////////////



///////////////////////////////////////////////////////////////////////////////////////////////////////////////
// main.html
///////////////////////////////////////////////////////////////////////////////////////////////////////////////

<html>
<head>
<meta name = "viewport" content = "initial-scale = 1.0, user-scalable = no" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<script type="text/javascript" src="NKit.js"></script>
<script type="text/javascript" src="jquery-1.7.1.min.js"></script>
<link charset="utf-8" href="main.css" media="screen" rel="stylesheet" type="text/css" />
<script type="text/javascript">
//disable touch scrolling
document.ontouchmove = function(event){event.preventDefault();}
var message;
NKRegisterClass("MyAppDelegate");
</script>
</head>
<body>
<a href="#" id="fb">Post to Facebook</a>
<script type="text/javascript">
$("a#fb").click(function(evt){
evt.preventDefault();
message = "I can post from NimbleKit to my Facebook News Feed!";
CallNKitAction("fbPost?className=MyAppDelegate");
});
</script>
</body>
</html>