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
Adds a simple login sample, and reflects changes to session object block handling

Summary:
Two changes in this revision: a new sample, tweaks to session behavior

Sample app is a focused sample, which uses only the FBSession SDK class, UIKit and
Foundation. Demonstrates the common login flow for Facebook authentication, including
handling of cached tokens, as well as app-transitions to accomodate authentication.
Note: to avoid sample-bloat, a hyperlink is used to demonstrate logged-in behavior.

Test Plan: manual testing of sample on simulator using iPhone and iPad configurations; session changes to get automated testing in a follow-on revision

Reviewers: mmarucheck, vijaye, leon, caabernathy

Reviewed By: vijaye

CC: yariv

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

Task ID: 958460, 955035
Fix Xcode build path in the static lib build script for Xcode 4.3.1+ or version downloaded from App Store

Summary: Previously xcodebuild could be found under the /Developer directory but it has since moved for Xcode downloaded from the App Store. If the developer has migrated from one version to another, then calling "which xcodebuild" will not work, unless they have run a script called "xcode-select switch". So for now we first check the older location, then look in the newer App Store location.

Test Plan: I tried running the build script in my folder after a recent upgrade from 4.2 to 4.3.1. Without the build script change I got an error. With the build script change, the library was generated.

Reviewers: mmarucheck, bruce, jacl

Reviewed By: jacl

CC: selekman, vijaye, jacl, gregschechte

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

Revert Plan: OK

Task ID: 998703
Fix build_distribution missing file, added .pmdoc

Summary:
There were two issues earlier:
- build_distribution.sh referenced a directory that did not get checked in.
- the resulting .pkg required root access but did not need to.

This fixes both by removing the unused directory reference and using .pmdoc
to generate the .pkg.  The .pmdoc allows finer tuning of the install
experience.

Test Plan: Run the script, install.

Reviewers: jacl, gregschechte, vijaye

Reviewed By: jacl

CC: security-diffs@lists

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

Revert Plan: Safe to revert.

Task ID: 1006546
Disk Cache and tests

Summary:
This is an SQLite based index and disk cache that keeps the MRU data blobs around, keyed off URL.

I plan to put the cache underneath FBURLConnection, when we identify CDN urls.  This will be useful (in fact, necessary)  when implementing friend picker for people with 1000s of friends - we can't keep all the images we fetch in memory.

Test Plan: Unit tests

Reviewed By: leon

Differential Revision: https://phabricator.fb.com/D439170
Places picker control - Headers

Summary:
Headers for review

FBPlacesPicker: A UI control that allows users to pick a place.  The notification is sent via a delegate that clients can listen to and dismiss the view controller that hosts this view.

(more comments inline)

Test Plan: None for headers

Reviewers: jacl, mmarucheck, gregschechte

Reviewed By: jacl

CC: ekoneil

Differential Revision: https://phabricator.fb.com/D441662
Reimplements Facebook in terms of Session

Summary:
As part of our migration to the new SDK design, Facebook class is now implemented in terms of
FBSession. Note that the interface to the Facebook class remains consistent, and the implementation
will be migrated further in a follow-on checkin related to FBRequest, and then again down the road
when we update FBDialog.

Test Plan: Manual testing of Hackbook, with whiteboxing all three login modes, token expiration, KVO, etc.

Reviewers: mmarucheck, vijaye, gregschechte, yariv, caabernathy

Reviewed By: mmarucheck

CC: yariv

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

Task ID: 958460