A Quick Look At Facebook's Updated SDK For Apple iOS

CatRambo 0 Tallied Votes 591 Views Share

Yesterday, Facebook released an updated SDK for the Apple iOS4 , intended for use with Apple's iPad, iPhone, and iPod Touch. Between this and the recently released Facebook SDK for Android, third-party developers can build applications with a social networking component for two of the most popular mobile platforms.

Two key features of the new release are and its use of OAuth 2.0 . The Graph API simplifies the way data is read from or written to Facebook. It looks at Facebook's social graph , the network of connections through which Facebook users communicate, and represents each object in the social graph with a unique ID that can be used to fetch such objects, including users, status messages, pages, events, photos, photo albums, groups etc. Relationships between these objects are sorted into connection types. The Graph API replaces the , which used HTTP requests to interact with Facebook.

The Graph API supports introspection of objects, allowing the developer to see all of the connections an object has without having to know their types in advance. The Graph API also allows developers to get detailed analytics about user demographics and how users are sharing the application programmatically. The API supports the Open Graph Protocol , which allows users to add their web pages to Facebook's social graph, regardless of whether or not they are Facebook pages.

The Graph API uses , a simplified version of OAuth, that uses SSL for API communication. It allows the application to obtain an access token from Facebook for a user in order to perform authorized requests on the user's behalf. Facebook Connect is being phased out in favor of OAuth 2.0.

While the most obvious use of the SDK would be for gaming applications, allowing users to compare scores or play against each other, it will also prove useful for news and information applications. One application showcasing the possibilities is FlipBoard , an iPad application that offers up individualized news and assembles it into a magazine format.

The update brings the SDK in line with the functionality offered by the Facebook SDK for Android released late last May, which already uses the Graphic API and OAuth 2.0. That SDK was written by Steven Soneff, an intern with the Facebook Mobile Platform team, as his internship project. Facebook has worked hard to make its platform available to developers, releasing Javascript and C# SDKs, among others, within the last couple of years and working with Microsoft on the Microsoft SDK for Facebook Platform , aimed at .NET developers.

Android and iOS-based phones still trail the most popular mobile device OS, RiM's Blackberry, but they're catching up quickly. Android-based Google phones accounted for 27% of new smartphone sales this quarter, and Android phone sales have grown over a whopping 800 percent over sales last year.

Dani AI

Generated

Good, concise summary by . Practical follow-up notes for anyone who finds this thread years later: Facebook’s iOS integration changed a lot after 2010, so treat the original SDK snapshot as historical. The checklist and troubleshooting below are the most useful, immediately actionable things missing from the original post.

Integration checklist (quick): register the iOS platform for your app on Facebook, add these top-level Info.plist keys and URL scheme entries, initialize the SDK in AppDelegate, and test on a real device (simulator auth behavior can differ). Example Info.plist fragment:

<key>CFBundleURLTypes</key>
<array>
  <dict>
    <key>CFBundleURLSchemes</key>
    <array>
      <string>fb1234567890</string>
    </array>
  </dict>
</array>
<key>FacebookAppID</key>
<string>1234567890</string>
<key>FacebookClientToken</key>
<string>CLIENT_TOKEN</string>
<key>FacebookDisplayName</key>
<string>MyApp</string>
<key>LSApplicationQueriesSchemes</key>
<array>
  <string>fbapi</string>
  <string>fbauth2</string>
  <string>fb-messenger-share-api</string>
  <string>fbshareextension</string>
</array>

Reference for plist and setup steps: Capgo guide. (capgo.app)

Login and permissions: use the official LoginKit flows (LoginManager / FBLoginButton) and request the minimum scopes needed. Any permission beyond the basic public profile/email path usually requires App Review (and sometimes business verification); keep test users while developing. Also pin and test the Graph API version your code uses because fields and endpoints are frequently changed or deprecated — plan updates around the Graph API changelog. See a concise example and notes here: AppCoda example, and background on App Review and versioning here: App Review guide and Graph API changelog summary. (appcoda.com)

Troubleshooting quick hits: missing or mis-nested plist keys and URL scheme is the single most common problem; make sure AppDelegate forwards open-URL calls to the SDK; on iOS 13+ implement the ASWebAuthenticationSession presentation anchor if the login UI hangs. If a Graph request fails with a version/field error, test the exact version and fields in the Graph API Explorer and update the SDK or API calls. Minimal login snippet (Swift):

let mgr = LoginManager()
mgr.logIn(permissions: ["public_profile","email"], from: self) { result, error in
  if let result = result, !result.isCancelled {
    GraphRequest(graphPath: "me", parameters: ["fields":"id,name,email"]).start { _, data, err in
      // handle user info
    }
  }
}

Apple notes on ASWebAuthenticationSession and presentation anchors: ASWebAuthenticationSession docs. (developer.apple.com)

Summary: follow a short plist + AppDelegate checklist, request minimal permissions, keep test users and an eye on Graph API versioning, and keep the SDK current before any platform migration.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.