Provide developers script they can use to get a static library version of the
iOS SDK

Summary:
For developers who are building apps with Automatic Reference Counting
enabled using our current iOS SDK will produce errors. One solution is to
provide a static library version of our SDK that they can include in their
project. We could provide detailed documentation to do this but it is easier to
provide a script that they can run. This diff introduces this script. We
considered actually packaging the desired library with the SDK but that would
involve a process change on our end because the current SDK development flow
does not include building a library. So for now we will push this on the
developer and perhaps in the future look at a more streamlined way to provide
this library to the developer.

Additionally, needed to make sure deployment target was set to iOS 3 for the
project.

Test Plan:
In terms of testing the script just run it a few times from various initial
locations, e.g.
% sh
/Users/caabernathy/Facebook/Code/iOS/StaticScriptTest/facebook-ios-sdk/scripts/build_facebook_ios_sdk_static_lib.sh

Also run it twice to see the output library properly overwritten

Once the library was produced, tested it worked well by doing the following
Scenario 1: Use the library with an app that does not have ARC enabled
1/ Built a simple app with Facebook SSO and a news feed dialog
2/ Tested SSO works and that the dialog UI has all the relevant resources and
works

Scenario 2: Use the library with an app with ARC enabled
1/ Built a simple app with Facebook SSO and a news feed dialog. (When creating
this app, made sure ARC was turned on)
2/ Tested SSO works and that the dialog UI has all the relevant resources and
works

Scenario 3: Switch out the Facebook SDK in the Hackbook sample app with this
library
1/ Removed the FBConnect folder from the Hackbook sample app
2/ Dragged in the new library, chose to copy the contents over
3/ Ran the app and went through all the flows. Note: Found some cases that do
not work that also appear to be broken in the current app, namely video upload,
and recent check-ins listing. These can be addressed separately.

Reviewers: yariv, jacl

Reviewed By: jacl

CC: mmarucheck, vijaye, selekman, brent

Differential Revision: https://phabricator.fb.com/D415047

Revert Plan: OK
Adds frictionless apprequest support

Summary:
Here are the mods to the sdk:
1. adds four methods to the Facebook class, for use by applications
  * enableFrictionlessRequests
  * reloadFrictionlessRecipientCache
  * isFrictionlessEnabledForRecipient
  * isFrictionlessEnabledForRecipients
2. extends dialog method and support class to support frictionless behavior for “apprequest” dialogs
3. extends Hacbook sample to add frictionless app-request support

Notes:
* enableFrictionlessRequests method of FBFrictionless turns on frictionless apprequest behavior in the SDK
* frictionless apprequest behavior means
  a.) a cache of allowed frictionless recipients is maintained
  b.) cache checked by dialog, and dialog is invisible for frictionless recipients
  c.) send responses are checked and recipient list is updated
  d.) logout and login cause clear and refetch of cache respectively
Added FBFrictionlessRequestSettings.m to the xcode project
Merge pull request #440 from alvarezm50/master

FBFrictionlessRequestSettings.m is missing from xcode project
Fixes url parsing bug -- reenables in-app auth flow

Summary:
Introduced a bug in URL parsing with the frictionless fix, which
failed to recognize urls that begin the parameter section with #

Test Plan:
Whitebox test using hackbook to force the in-app auth flow, and
confirm that the new line enables parsing of the returned URL

Reviewers: yariv, caabernathy, mmarucheck, vijaye

Reviewed By: mmarucheck

Differential Revision: https://phabricator.fb.com/D425267
Fix issue causing blank white dialog when loading friends list

Summary:
Set the UIActivityIndicator color to gray to stop it from blending into the background.
On iOS5 we do this by setting the color to gray. On older iOS versions which don't support this
property, this is done by setting the style to UIActivityIndicatorViewStyleGray instead of
UIActivityIndicatorViewStyleWhiteLarge which results in a slightly smaller indicator.

Test Plan: Testing using Hackbook.

Reviewers: jacl, dgibson

Reviewed By: jacl

Differential Revision: https://phabricator.fb.com/D426894

Task ID: 908016
Use [NSDictionary objectForKey:] instead of [NSDictionary valueForKey:] to access objects in dictionaries

Summary: valueForKey also works in this case since none of our keys are strings staring with "@". However, objectForKey: is the correct selector to use for the desired behavior.

Test Plan: Verify behavior with HackBook app

Reviewers: jacl, dgibson

Reviewed By: jacl

Differential Revision: https://phabricator.fb.com/D427850

Task ID: 854847
Fix a bug that caused request: didLoad: to be called with the raw response instead of a string when the response does not represent a valid JSON object.

Summary:
If the response is not a JSON object, convert the actual response to a string instead of using the NSData object.
This will break clients that depend on the current behavior. If you need access to the raw response, use request: diReceiveResponse: instead.

Test Plan: Test with stream.publish requests

Reviewers: jacl, dgibson, yariv, caabernathy

Reviewed By: jacl

CC: leon

Differential Revision: https://phabricator.fb.com/D427844

Task ID: 842334
Header spec for FBSession + POR for next rev iOS SDK

Summary:
This diff contains a header-spec for FBSession, as well as
a header and POR for the next rev of the sdk

Test Plan: n/a

Reviewers: mmarucheck, vijaye, gregschechte, ekoneil

Reviewed By: vijaye

Differential Revision: https://phabricator.fb.com/D424291
Adapted earlier build script to create a .framework and a .pkg.

Summary:
This extends the build_facebook_ios_sdk_static_lib.sh to build
a .framework file, and adds a script to package that and the
templates we will add into an installer .pkg.

These scripts are used by the SDK team to generate binaries
for distribution, and the build_framework script may be
useful to developers who clone the github repository and
want to build the framework with their own local changes.

Also added new headers to the build, and distinguish between
public and project header files.  Since existing projects do not
currently use the .framework, they continue to include headers
directly and are unaffected by public/project.  The legacy
headers are available for copying in the framework download
under FBiOSSDK.framework/Versions/A/LegacyHeaders.

Test Plan:
- Run both scripts
- Verify setup installs a sample template that XCode picks up.
- Verify that the .framework is usable in Vijaye's sample.

Reviewers: jacl, vijaye

Reviewed By: vijaye

CC: gregschechte, security-diffs@lists, yariv

Differential Revision: https://phabricator.fb.com/D431587

Task ID: 981284
Header spec for FBRequest, including migration approach

Summary:
This diff contains a header for style and design review for
FBRequest, as well as for the approach to incremental
migration.

Test Plan: N/A

Reviewers: mmarucheck, vijaye, gregschechte, ekoneil, toddkrabach

Reviewed By: vijaye

CC: yariv, suhas

Differential Revision: https://phabricator.fb.com/D429749
Fix memory leaks in Hackbook

Summary:
1) img was alloc'ed and never released while uploading a photo
2) alertview was alloc'ed and never released
3) friendswithapp was alloc'ed twice and never released, updated the logic to use obj c syntax
4) UIGraphicsGetImageFromCurrentImageContext() returns an autoreleased imageView - retaining it is the incorrect solution. See http://stackoverflow.com/questions/1529667/memory-allocation-and-release-for-uiimage-in-iphone

Test Plan:
Run Hackbook in the profiler and verify no memory leaks when loading userpic from the graph api
Upload a photo, verify no longer leaks
View friends with app, verify no longer leaks
Pop the alertview and verify no longer leaks

Reviewers: jacl, caabernathy, mattwkelly, selekman

Reviewed By: jacl

Differential Revision: https://phabricator.fb.com/D430905

Task ID: 980129
Quick fix to ignore expected deprecation warnings
Profile picture control

Summary: Adds a profile picture control with graph api accepted picture types (square, small, normal, large)

Test Plan:
Create a sample app and use the profile picture control on a bunch of user ids
Change the type and userid at runtime and verify that the profile image updates appropriately

Reviewers: jacl, mmarucheck, leon, toddkrabach

Reviewed By: jacl

CC: gregschechte, yariv, greg

Differential Revision: https://phabricator.fb.com/D433395
Rename sample -> samples

Differential Revision: https://phabricator.fb.com/D434580
Sample app that uses Profile picture view

Summary:
Sample app exercising the FBProfilePictureView.  Sets userid and changes size at runtime.

* Note:: Also added initWithFrame & initWithCoder in ProfilePictureView.  When used in a NIB, the UIView doesn't get the init message - but instead it gets the initWithCoder.  This interestingly doesn't call init.  So I brought back the "self-initialize" designated initializer.

Test Plan: Verify that the app works correctly

Reviewers: jacl, mmarucheck, leon, toddkrabach

Reviewed By: leon

CC: gregschechte, security-diffs@lists

Differential Revision: https://phabricator.fb.com/D434684
Merge URL connection classes

Summary:
Vijaye checked in a URL wrapper for the profile picture control.  I had
written one for FBRequest.  This merges the two, and changes existing
code to use the merged one.

This involves FBError changes to handle cancel.

Test Plan: Run ProfilePictureView sample

Reviewers: jacl, leon, toddkrabach, vijaye

Reviewed By: vijaye

CC: security-diffs@lists, yariv

Differential Revision: https://phabricator.fb.com/D435879

Revert Plan: Safe to revert

Task ID: 990920
Fixing resource paths

Summary: The file names in the project were wrong

Test Plan: Verified project builds

Reviewers: mmarucheck, jacl

Reviewed By: mmarucheck

CC: yariv

Differential Revision: https://phabricator.fb.com/D436846
Session implementation part 1 -- main impl

Summary:
This diff contains the main portion of the new Session implementation. This includes
all of the core login UX, and parity with Facebook.m Follow-on parts are -
  part 2 -- refactored Facebook class + sample app
  part 3 -- (After first FBRequest checkin), internal notification support

Test Plan: Local sample application used to run through the new codepaths manually

Reviewers: mmarucheck, vijaye, gregschechte, toddkrabach, leon

Reviewed By: mmarucheck

CC: yariv

Differential Revision: https://phabricator.fb.com/D437941

Task ID: 958460
Add switch to framework build script to build for debug + bug fixes

Summary:
Add support for Debug and Release parameters to build_framework.sh,
also fixed typo in private property that yield broken retain behavior
for block, as well as defect in token expiration check logic

Test Plan: manual testing of script, whitebox testing of bug fixes

Reviewers: mmarucheck, vijaye

Reviewed By: vijaye

Differential Revision: https://phabricator.fb.com/D441130

Task ID: 958460