- Update
No files matched your search
|
After Width: | Height: | Size: 9.8 KiB |
|
After Width: | Height: | Size: 8.8 KiB |
|
After Width: | Height: | Size: 13 KiB |
@@ -0,0 +1,29 @@
|
||||
Scrumptious sample
|
||||
|
||||
Scrumptious demonstrates a "real-world" (albeit very limited) application that integrates with Facebook.
|
||||
It allows a user to select from a small pre-defined list of cuisine types that they are eating, then
|
||||
tag friends who they are with, and tag the restaurant they are in. Scrumptious then allows them to post an
|
||||
Open Graph Action to their Timeline which will display the the tagged friends and location.
|
||||
|
||||
The example utilizes several controls for the Facebook SDK including:
|
||||
FBLoginView - used on the landing page for authenticating the user.
|
||||
FBFriendPickerViewController - presented from the main UI to pick friends.
|
||||
FBPlacePickerViewController - presented from the main UI to pick a location.
|
||||
FBuserSettingsViewController - used to log the user out.
|
||||
|
||||
Furthermore, the sample demonstrates usage of Open Graph objects and actions. While the functionality is
|
||||
quite constrained in order to be of reasonable size for a sample, the Facebook integration could serve
|
||||
as the basis for more full-featured applications. In particular, look for the text "Facebook SDK" to identify
|
||||
key integration points.
|
||||
|
||||
Scrumptious also demonstrates how to override images and locale specific strings. This uses the same image as the SDK, but it is actually
|
||||
loaded from the Scrumptious bundle instead of the SDK. Strings in English are the same, but if the phone is switched into Hebrew, Hebrew
|
||||
strings will appear. For further information please look at FacebookSDKResources.bundle.README
|
||||
|
||||
If using Scrumptious as the basis for another application, please note that all of the Open Graph namespaces will need
|
||||
to be updated, and a hosted service must be provided in order to serve up Open Graph Objects. In addition, the logged-in
|
||||
user will need to be a Developer or a Tester on the application until it is approved for posting Open Graph Actions.
|
||||
|
||||
Using the Sample
|
||||
Install the Facebook SDK for iOS.
|
||||
Launch the Scrumptious project using Xcode from the <Facebook SDK>/samples/Scrumptious directory.
|
||||
@@ -0,0 +1,426 @@
|
||||
// !$*UTF8*$!
|
||||
{
|
||||
archiveVersion = 1;
|
||||
classes = {
|
||||
};
|
||||
objectVersion = 46;
|
||||
objects = {
|
||||
|
||||
/* Begin PBXBuildFile section */
|
||||
846809C1158F85A100F2DBB9 /* action-eating.png in Resources */ = {isa = PBXBuildFile; fileRef = 846809BD158F85A100F2DBB9 /* action-eating.png */; };
|
||||
846809C2158F85A100F2DBB9 /* action-location.png in Resources */ = {isa = PBXBuildFile; fileRef = 846809BE158F85A100F2DBB9 /* action-location.png */; };
|
||||
846809C3158F85A100F2DBB9 /* action-people.png in Resources */ = {isa = PBXBuildFile; fileRef = 846809BF158F85A100F2DBB9 /* action-people.png */; };
|
||||
8527EC6815C9DB3800660673 /* Scrumptious.strings in Resources */ = {isa = PBXBuildFile; fileRef = 8527EC6A15C9DB3800660673 /* Scrumptious.strings */; };
|
||||
8534B4DF15CC657900348ED2 /* FBUserSettingsViewResources.bundle in Resources */ = {isa = PBXBuildFile; fileRef = 8534B4DE15CC657900348ED2 /* FBUserSettingsViewResources.bundle */; };
|
||||
856DC21A1577F105001FA6A6 /* Icon-72.png in Resources */ = {isa = PBXBuildFile; fileRef = 856DC2171577F105001FA6A6 /* Icon-72.png */; };
|
||||
856DC21B1577F105001FA6A6 /* Icon.png in Resources */ = {isa = PBXBuildFile; fileRef = 856DC2181577F105001FA6A6 /* Icon.png */; };
|
||||
856DC21C1577F105001FA6A6 /* Icon@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 856DC2191577F105001FA6A6 /* Icon@2x.png */; };
|
||||
8592BE3D15816CCC00056680 /* AddressBook.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8592BE3C15816CCC00056680 /* AddressBook.framework */; };
|
||||
85C69DCA1602B411008AD9A0 /* Default-568h@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 85C69DC71602B411008AD9A0 /* Default-568h@2x.png */; };
|
||||
85C69DCB1602B411008AD9A0 /* Default.png in Resources */ = {isa = PBXBuildFile; fileRef = 85C69DC81602B411008AD9A0 /* Default.png */; };
|
||||
85C69DCC1602B411008AD9A0 /* Default@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 85C69DC91602B411008AD9A0 /* Default@2x.png */; };
|
||||
99FAE2271782302A009E0AAE /* FacebookSDKOverrides.bundle in Resources */ = {isa = PBXBuildFile; fileRef = 99FAE2261782302A009E0AAE /* FacebookSDKOverrides.bundle */; };
|
||||
9D084048169CE00B000FD49D /* ReadMe.txt in Resources */ = {isa = PBXBuildFile; fileRef = 9D084047169CE00B000FD49D /* ReadMe.txt */; };
|
||||
9D343BCF17187E4200DBC569 /* SCPhotoViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 9D564E03171334CB00BEEEDE /* SCPhotoViewController.m */; };
|
||||
9D343BD017187E8700DBC569 /* SCPhotoViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 9D564E04171334CB00BEEEDE /* SCPhotoViewController.xib */; };
|
||||
9D564E06171334EA00BEEEDE /* action-photo.png in Resources */ = {isa = PBXBuildFile; fileRef = 9D564E05171334EA00BEEEDE /* action-photo.png */; };
|
||||
B9C1C35915129F0E008FA5D1 /* CoreLocation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B9C1C35815129F0E008FA5D1 /* CoreLocation.framework */; };
|
||||
B9CD0A74150EA4DD00560A93 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B9CD0A73150EA4DD00560A93 /* UIKit.framework */; };
|
||||
B9CD0A76150EA4DD00560A93 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B9CD0A75150EA4DD00560A93 /* Foundation.framework */; };
|
||||
B9CD0A78150EA4DD00560A93 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B9CD0A77150EA4DD00560A93 /* CoreGraphics.framework */; };
|
||||
B9CD0A7E150EA4DD00560A93 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = B9CD0A7C150EA4DD00560A93 /* InfoPlist.strings */; };
|
||||
B9CD0A80150EA4DD00560A93 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = B9CD0A7F150EA4DD00560A93 /* main.m */; };
|
||||
B9CD0A84150EA4DD00560A93 /* SCAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = B9CD0A83150EA4DD00560A93 /* SCAppDelegate.m */; };
|
||||
B9CD0A87150EA4DD00560A93 /* SCViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = B9CD0A86150EA4DD00560A93 /* SCViewController.m */; };
|
||||
B9CD0A8D150EA4DE00560A93 /* SCViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = B9CD0A8B150EA4DE00560A93 /* SCViewController.xib */; };
|
||||
B9CD0A96150EBF5400560A93 /* SCLoginViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = B9CD0A94150EBF5400560A93 /* SCLoginViewController.m */; };
|
||||
B9CD0A97150EBF5400560A93 /* SCLoginViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = B9CD0A95150EBF5400560A93 /* SCLoginViewController.xib */; };
|
||||
B9CD0A9A150EBFFB00560A93 /* facebook.png in Resources */ = {isa = PBXBuildFile; fileRef = B9CD0A99150EBFFB00560A93 /* facebook.png */; };
|
||||
DD55EAAF15AB9EDF000A64B8 /* FacebookSDK.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DD55EAAE15AB9EDF000A64B8 /* FacebookSDK.framework */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
846809BD158F85A100F2DBB9 /* action-eating.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "action-eating.png"; path = "scrumptious/images/action-eating.png"; sourceTree = SOURCE_ROOT; };
|
||||
846809BE158F85A100F2DBB9 /* action-location.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "action-location.png"; path = "scrumptious/images/action-location.png"; sourceTree = SOURCE_ROOT; };
|
||||
846809BF158F85A100F2DBB9 /* action-people.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "action-people.png"; path = "scrumptious/images/action-people.png"; sourceTree = SOURCE_ROOT; };
|
||||
8527EC6915C9DB3800660673 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/Scrumptious.strings; sourceTree = "<group>"; };
|
||||
8527EC6B15C9DB4A00660673 /* he */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = he; path = he.lproj/Scrumptious.strings; sourceTree = "<group>"; };
|
||||
8534B4DE15CC657900348ED2 /* FBUserSettingsViewResources.bundle */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.plug-in"; name = FBUserSettingsViewResources.bundle; path = ../../build/FacebookSDK.framework/Versions/A/Resources/FBUserSettingsViewResources.bundle; sourceTree = "<group>"; };
|
||||
856DC2171577F105001FA6A6 /* Icon-72.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "Icon-72.png"; path = "../Icon-72.png"; sourceTree = "<group>"; };
|
||||
856DC2181577F105001FA6A6 /* Icon.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = Icon.png; path = ../Icon.png; sourceTree = "<group>"; };
|
||||
856DC2191577F105001FA6A6 /* Icon@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "Icon@2x.png"; path = "../Icon@2x.png"; sourceTree = "<group>"; };
|
||||
8592BE3C15816CCC00056680 /* AddressBook.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AddressBook.framework; path = System/Library/Frameworks/AddressBook.framework; sourceTree = SDKROOT; };
|
||||
85954AE1155889A200FABA9A /* SCProtocols.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SCProtocols.h; sourceTree = "<group>"; };
|
||||
85C69DC71602B411008AD9A0 /* Default-568h@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "Default-568h@2x.png"; path = "scrumptious/Default-568h@2x.png"; sourceTree = SOURCE_ROOT; };
|
||||
85C69DC81602B411008AD9A0 /* Default.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = Default.png; path = scrumptious/Default.png; sourceTree = SOURCE_ROOT; };
|
||||
85C69DC91602B411008AD9A0 /* Default@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "Default@2x.png"; path = "scrumptious/Default@2x.png"; sourceTree = SOURCE_ROOT; };
|
||||
99FAE2261782302A009E0AAE /* FacebookSDKOverrides.bundle */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.plug-in"; name = FacebookSDKOverrides.bundle; path = scrumptious/FacebookSDKOverrides.bundle; sourceTree = SOURCE_ROOT; };
|
||||
9D084047169CE00B000FD49D /* ReadMe.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = ReadMe.txt; sourceTree = "<group>"; };
|
||||
9D564E02171334CB00BEEEDE /* SCPhotoViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SCPhotoViewController.h; path = scrumptious/SCPhotoViewController.h; sourceTree = SOURCE_ROOT; };
|
||||
9D564E03171334CB00BEEEDE /* SCPhotoViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = SCPhotoViewController.m; path = scrumptious/SCPhotoViewController.m; sourceTree = SOURCE_ROOT; };
|
||||
9D564E04171334CB00BEEEDE /* SCPhotoViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = SCPhotoViewController.xib; path = scrumptious/SCPhotoViewController.xib; sourceTree = SOURCE_ROOT; };
|
||||
9D564E05171334EA00BEEEDE /* action-photo.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "action-photo.png"; path = "scrumptious/images/action-photo.png"; sourceTree = SOURCE_ROOT; };
|
||||
B9C1C35815129F0E008FA5D1 /* CoreLocation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreLocation.framework; path = System/Library/Frameworks/CoreLocation.framework; sourceTree = SDKROOT; };
|
||||
B9CD0A6F150EA4DD00560A93 /* Scrumptious.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Scrumptious.app; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
B9CD0A73150EA4DD00560A93 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; };
|
||||
B9CD0A75150EA4DD00560A93 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
|
||||
B9CD0A77150EA4DD00560A93 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; };
|
||||
B9CD0A7B150EA4DD00560A93 /* Scrumptious-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "Scrumptious-Info.plist"; sourceTree = "<group>"; };
|
||||
B9CD0A7D150EA4DD00560A93 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = "<group>"; };
|
||||
B9CD0A7F150EA4DD00560A93 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
|
||||
B9CD0A81150EA4DD00560A93 /* Scrumptious-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Scrumptious-Prefix.pch"; sourceTree = "<group>"; };
|
||||
B9CD0A82150EA4DD00560A93 /* SCAppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SCAppDelegate.h; sourceTree = "<group>"; };
|
||||
B9CD0A83150EA4DD00560A93 /* SCAppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SCAppDelegate.m; sourceTree = "<group>"; };
|
||||
B9CD0A85150EA4DD00560A93 /* SCViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SCViewController.h; sourceTree = "<group>"; };
|
||||
B9CD0A86150EA4DD00560A93 /* SCViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SCViewController.m; sourceTree = "<group>"; };
|
||||
B9CD0A8C150EA4DE00560A93 /* en */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = en; path = en.lproj/SCViewController.xib; sourceTree = "<group>"; };
|
||||
B9CD0A93150EBF5400560A93 /* SCLoginViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SCLoginViewController.h; sourceTree = "<group>"; };
|
||||
B9CD0A94150EBF5400560A93 /* SCLoginViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SCLoginViewController.m; sourceTree = "<group>"; };
|
||||
B9CD0A95150EBF5400560A93 /* SCLoginViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = SCLoginViewController.xib; sourceTree = "<group>"; };
|
||||
B9CD0A99150EBFFB00560A93 /* facebook.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = facebook.png; path = images/facebook.png; sourceTree = "<group>"; };
|
||||
DD55EAAE15AB9EDF000A64B8 /* FacebookSDK.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = FacebookSDK.framework; path = ../../build/FacebookSDK.framework; sourceTree = "<group>"; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
B9CD0A6C150EA4DD00560A93 /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
B9C1C35915129F0E008FA5D1 /* CoreLocation.framework in Frameworks */,
|
||||
B9CD0A74150EA4DD00560A93 /* UIKit.framework in Frameworks */,
|
||||
B9CD0A76150EA4DD00560A93 /* Foundation.framework in Frameworks */,
|
||||
B9CD0A78150EA4DD00560A93 /* CoreGraphics.framework in Frameworks */,
|
||||
8592BE3D15816CCC00056680 /* AddressBook.framework in Frameworks */,
|
||||
DD55EAAF15AB9EDF000A64B8 /* FacebookSDK.framework in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXFrameworksBuildPhase section */
|
||||
|
||||
/* Begin PBXGroup section */
|
||||
B9CD0A64150EA4DD00560A93 = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
9D084047169CE00B000FD49D /* ReadMe.txt */,
|
||||
B9CD0A79150EA4DD00560A93 /* Scrumptious */,
|
||||
B9CD0A72150EA4DD00560A93 /* Frameworks */,
|
||||
B9CD0A70150EA4DD00560A93 /* Products */,
|
||||
);
|
||||
indentWidth = 4;
|
||||
sourceTree = "<group>";
|
||||
tabWidth = 4;
|
||||
};
|
||||
B9CD0A70150EA4DD00560A93 /* Products */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
B9CD0A6F150EA4DD00560A93 /* Scrumptious.app */,
|
||||
);
|
||||
name = Products;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
B9CD0A72150EA4DD00560A93 /* Frameworks */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
8534B4DE15CC657900348ED2 /* FBUserSettingsViewResources.bundle */,
|
||||
DD55EAAE15AB9EDF000A64B8 /* FacebookSDK.framework */,
|
||||
8592BE3C15816CCC00056680 /* AddressBook.framework */,
|
||||
B9C1C35815129F0E008FA5D1 /* CoreLocation.framework */,
|
||||
B9CD0A73150EA4DD00560A93 /* UIKit.framework */,
|
||||
B9CD0A75150EA4DD00560A93 /* Foundation.framework */,
|
||||
B9CD0A77150EA4DD00560A93 /* CoreGraphics.framework */,
|
||||
);
|
||||
name = Frameworks;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
B9CD0A79150EA4DD00560A93 /* Scrumptious */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
99FAE2261782302A009E0AAE /* FacebookSDKOverrides.bundle */,
|
||||
B9CD0A98150EBFBD00560A93 /* images */,
|
||||
B9CD0A7A150EA4DD00560A93 /* Supporting Files */,
|
||||
B9CD0A82150EA4DD00560A93 /* SCAppDelegate.h */,
|
||||
B9CD0A83150EA4DD00560A93 /* SCAppDelegate.m */,
|
||||
B9CD0A93150EBF5400560A93 /* SCLoginViewController.h */,
|
||||
B9CD0A94150EBF5400560A93 /* SCLoginViewController.m */,
|
||||
B9CD0A95150EBF5400560A93 /* SCLoginViewController.xib */,
|
||||
9D564E02171334CB00BEEEDE /* SCPhotoViewController.h */,
|
||||
9D564E03171334CB00BEEEDE /* SCPhotoViewController.m */,
|
||||
9D564E04171334CB00BEEEDE /* SCPhotoViewController.xib */,
|
||||
B9CD0A85150EA4DD00560A93 /* SCViewController.h */,
|
||||
B9CD0A86150EA4DD00560A93 /* SCViewController.m */,
|
||||
B9CD0A8B150EA4DE00560A93 /* SCViewController.xib */,
|
||||
85954AE1155889A200FABA9A /* SCProtocols.h */,
|
||||
8527EC6A15C9DB3800660673 /* Scrumptious.strings */,
|
||||
);
|
||||
path = Scrumptious;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
B9CD0A7A150EA4DD00560A93 /* Supporting Files */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
85C69DC71602B411008AD9A0 /* Default-568h@2x.png */,
|
||||
85C69DC81602B411008AD9A0 /* Default.png */,
|
||||
85C69DC91602B411008AD9A0 /* Default@2x.png */,
|
||||
B9CD0A7B150EA4DD00560A93 /* Scrumptious-Info.plist */,
|
||||
B9CD0A7C150EA4DD00560A93 /* InfoPlist.strings */,
|
||||
B9CD0A7F150EA4DD00560A93 /* main.m */,
|
||||
B9CD0A81150EA4DD00560A93 /* Scrumptious-Prefix.pch */,
|
||||
);
|
||||
name = "Supporting Files";
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
B9CD0A98150EBFBD00560A93 /* images */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
846809BD158F85A100F2DBB9 /* action-eating.png */,
|
||||
846809BE158F85A100F2DBB9 /* action-location.png */,
|
||||
846809BF158F85A100F2DBB9 /* action-people.png */,
|
||||
9D564E05171334EA00BEEEDE /* action-photo.png */,
|
||||
856DC2171577F105001FA6A6 /* Icon-72.png */,
|
||||
856DC2181577F105001FA6A6 /* Icon.png */,
|
||||
856DC2191577F105001FA6A6 /* Icon@2x.png */,
|
||||
B9CD0A99150EBFFB00560A93 /* facebook.png */,
|
||||
);
|
||||
name = images;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXGroup section */
|
||||
|
||||
/* Begin PBXNativeTarget section */
|
||||
B9CD0A6E150EA4DD00560A93 /* Scrumptious */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = B9CD0A90150EA4DE00560A93 /* Build configuration list for PBXNativeTarget "Scrumptious" */;
|
||||
buildPhases = (
|
||||
B9CD0A6B150EA4DD00560A93 /* Sources */,
|
||||
B9CD0A6C150EA4DD00560A93 /* Frameworks */,
|
||||
B9CD0A6D150EA4DD00560A93 /* Resources */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
);
|
||||
name = Scrumptious;
|
||||
productName = Scrumptious;
|
||||
productReference = B9CD0A6F150EA4DD00560A93 /* Scrumptious.app */;
|
||||
productType = "com.apple.product-type.application";
|
||||
};
|
||||
/* End PBXNativeTarget section */
|
||||
|
||||
/* Begin PBXProject section */
|
||||
B9CD0A66150EA4DD00560A93 /* Project object */ = {
|
||||
isa = PBXProject;
|
||||
attributes = {
|
||||
LastUpgradeCheck = 0460;
|
||||
};
|
||||
buildConfigurationList = B9CD0A69150EA4DD00560A93 /* Build configuration list for PBXProject "Scrumptious" */;
|
||||
compatibilityVersion = "Xcode 3.2";
|
||||
developmentRegion = English;
|
||||
hasScannedForEncodings = 0;
|
||||
knownRegions = (
|
||||
en,
|
||||
he,
|
||||
);
|
||||
mainGroup = B9CD0A64150EA4DD00560A93;
|
||||
productRefGroup = B9CD0A70150EA4DD00560A93 /* Products */;
|
||||
projectDirPath = "";
|
||||
projectRoot = "";
|
||||
targets = (
|
||||
B9CD0A6E150EA4DD00560A93 /* Scrumptious */,
|
||||
);
|
||||
};
|
||||
/* End PBXProject section */
|
||||
|
||||
/* Begin PBXResourcesBuildPhase section */
|
||||
B9CD0A6D150EA4DD00560A93 /* Resources */ = {
|
||||
isa = PBXResourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
9D343BD017187E8700DBC569 /* SCPhotoViewController.xib in Resources */,
|
||||
B9CD0A7E150EA4DD00560A93 /* InfoPlist.strings in Resources */,
|
||||
B9CD0A8D150EA4DE00560A93 /* SCViewController.xib in Resources */,
|
||||
B9CD0A97150EBF5400560A93 /* SCLoginViewController.xib in Resources */,
|
||||
B9CD0A9A150EBFFB00560A93 /* facebook.png in Resources */,
|
||||
856DC21A1577F105001FA6A6 /* Icon-72.png in Resources */,
|
||||
856DC21B1577F105001FA6A6 /* Icon.png in Resources */,
|
||||
856DC21C1577F105001FA6A6 /* Icon@2x.png in Resources */,
|
||||
846809C1158F85A100F2DBB9 /* action-eating.png in Resources */,
|
||||
846809C2158F85A100F2DBB9 /* action-location.png in Resources */,
|
||||
846809C3158F85A100F2DBB9 /* action-people.png in Resources */,
|
||||
8527EC6815C9DB3800660673 /* Scrumptious.strings in Resources */,
|
||||
8534B4DF15CC657900348ED2 /* FBUserSettingsViewResources.bundle in Resources */,
|
||||
85C69DCA1602B411008AD9A0 /* Default-568h@2x.png in Resources */,
|
||||
85C69DCB1602B411008AD9A0 /* Default.png in Resources */,
|
||||
85C69DCC1602B411008AD9A0 /* Default@2x.png in Resources */,
|
||||
9D084048169CE00B000FD49D /* ReadMe.txt in Resources */,
|
||||
9D564E06171334EA00BEEEDE /* action-photo.png in Resources */,
|
||||
99FAE2271782302A009E0AAE /* FacebookSDKOverrides.bundle in Resources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXResourcesBuildPhase section */
|
||||
|
||||
/* Begin PBXSourcesBuildPhase section */
|
||||
B9CD0A6B150EA4DD00560A93 /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
9D343BCF17187E4200DBC569 /* SCPhotoViewController.m in Sources */,
|
||||
B9CD0A80150EA4DD00560A93 /* main.m in Sources */,
|
||||
B9CD0A84150EA4DD00560A93 /* SCAppDelegate.m in Sources */,
|
||||
B9CD0A87150EA4DD00560A93 /* SCViewController.m in Sources */,
|
||||
B9CD0A96150EBF5400560A93 /* SCLoginViewController.m in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXSourcesBuildPhase section */
|
||||
|
||||
/* Begin PBXVariantGroup section */
|
||||
8527EC6A15C9DB3800660673 /* Scrumptious.strings */ = {
|
||||
isa = PBXVariantGroup;
|
||||
children = (
|
||||
8527EC6915C9DB3800660673 /* en */,
|
||||
8527EC6B15C9DB4A00660673 /* he */,
|
||||
);
|
||||
name = Scrumptious.strings;
|
||||
path = scrumptious;
|
||||
sourceTree = SOURCE_ROOT;
|
||||
};
|
||||
B9CD0A7C150EA4DD00560A93 /* InfoPlist.strings */ = {
|
||||
isa = PBXVariantGroup;
|
||||
children = (
|
||||
B9CD0A7D150EA4DD00560A93 /* en */,
|
||||
);
|
||||
name = InfoPlist.strings;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
B9CD0A8B150EA4DE00560A93 /* SCViewController.xib */ = {
|
||||
isa = PBXVariantGroup;
|
||||
children = (
|
||||
B9CD0A8C150EA4DE00560A93 /* en */,
|
||||
);
|
||||
name = SCViewController.xib;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXVariantGroup section */
|
||||
|
||||
/* Begin XCBuildConfiguration section */
|
||||
B9CD0A8E150EA4DE00560A93 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
ARCHS = "$(ARCHS_STANDARD_32_BIT)";
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
||||
COPY_PHASE_STRIP = NO;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu99;
|
||||
GCC_DYNAMIC_NO_PIC = NO;
|
||||
GCC_OPTIMIZATION_LEVEL = 0;
|
||||
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||
"DEBUG=1",
|
||||
"$(inherited)",
|
||||
);
|
||||
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
|
||||
GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES;
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 5.0;
|
||||
SDKROOT = iphoneos;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
B9CD0A8F150EA4DE00560A93 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
ARCHS = "$(ARCHS_STANDARD_32_BIT)";
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
||||
COPY_PHASE_STRIP = YES;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu99;
|
||||
GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES;
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 5.0;
|
||||
OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1";
|
||||
SDKROOT = iphoneos;
|
||||
VALIDATE_PRODUCT = YES;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
B9CD0A91150EA4DE00560A93 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
CODE_SIGN_IDENTITY = "iPhone Developer";
|
||||
FRAMEWORK_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"\"$(SRCROOT)/../../build\"",
|
||||
);
|
||||
GCC_PRECOMPILE_PREFIX_HEADER = YES;
|
||||
GCC_PREFIX_HEADER = "Scrumptious/Scrumptious-Prefix.pch";
|
||||
GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES;
|
||||
INFOPLIST_FILE = "Scrumptious/Scrumptious-Info.plist";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 5.0;
|
||||
LIBRARY_SEARCH_PATHS = "$(inherited)";
|
||||
OTHER_LDFLAGS = "-ObjC";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
PROVISIONING_PROFILE = "";
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
WRAPPER_EXTENSION = app;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
B9CD0A92150EA4DE00560A93 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
FRAMEWORK_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"\"$(SRCROOT)/../../build\"",
|
||||
);
|
||||
GCC_PRECOMPILE_PREFIX_HEADER = YES;
|
||||
GCC_PREFIX_HEADER = "Scrumptious/Scrumptious-Prefix.pch";
|
||||
GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES;
|
||||
INFOPLIST_FILE = "Scrumptious/Scrumptious-Info.plist";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 5.0;
|
||||
LIBRARY_SEARCH_PATHS = "$(inherited)";
|
||||
OTHER_LDFLAGS = "-ObjC";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
WRAPPER_EXTENSION = app;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
/* End XCBuildConfiguration section */
|
||||
|
||||
/* Begin XCConfigurationList section */
|
||||
B9CD0A69150EA4DD00560A93 /* Build configuration list for PBXProject "Scrumptious" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
B9CD0A8E150EA4DE00560A93 /* Debug */,
|
||||
B9CD0A8F150EA4DE00560A93 /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
B9CD0A90150EA4DE00560A93 /* Build configuration list for PBXNativeTarget "Scrumptious" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
B9CD0A91150EA4DE00560A93 /* Debug */,
|
||||
B9CD0A92150EA4DE00560A93 /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
/* End XCConfigurationList section */
|
||||
};
|
||||
rootObject = B9CD0A66150EA4DD00560A93 /* Project object */;
|
||||
}
|
||||
|
After Width: | Height: | Size: 3.6 KiB |
|
After Width: | Height: | Size: 1.3 KiB |
|
After Width: | Height: | Size: 3.7 KiB |
|
After Width: | Height: | Size: 710 B |
|
After Width: | Height: | Size: 1.4 KiB |
@@ -0,0 +1,36 @@
|
||||
/*
|
||||
* Copyright 2010-present Facebook.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
#import <FacebookSDK/FacebookSDK.h>
|
||||
|
||||
@class SCViewController;
|
||||
@class SCLoginViewController;
|
||||
|
||||
// Scrumptious sample application
|
||||
//
|
||||
// The purpose of the Scrumptious sample application is to demonstrate a complete real-world
|
||||
// application that includes Facebook integration, friend picker, place picker, and Open Graph
|
||||
// Action creation and posting.
|
||||
@interface SCAppDelegate : UIResponder <UIApplicationDelegate, UINavigationControllerDelegate>
|
||||
@property (strong, nonatomic) UIWindow *window;
|
||||
@property (strong, nonatomic) UINavigationController *navigationController;
|
||||
@property (strong, nonatomic) SCViewController *mainViewController;
|
||||
@property (strong, nonatomic) SCLoginViewController* loginViewController;
|
||||
@property BOOL isNavigating;
|
||||
|
||||
- (void)resetMainViewController;
|
||||
@end
|
||||
@@ -0,0 +1,135 @@
|
||||
/*
|
||||
* Copyright 2010-present Facebook.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#import "SCAppDelegate.h"
|
||||
#import "SCViewController.h"
|
||||
#import "SCLoginViewController.h"
|
||||
#import <FacebookSDK/FBSessionTokenCachingStrategy.h>
|
||||
|
||||
@implementation SCAppDelegate
|
||||
|
||||
@synthesize window = _window,
|
||||
navigationController = _navigationController,
|
||||
mainViewController = _mainViewController,
|
||||
loginViewController = _loginViewController,
|
||||
isNavigating = _isNavigating;
|
||||
|
||||
- (BOOL)application:(UIApplication *)application
|
||||
openURL:(NSURL *)url
|
||||
sourceApplication:(NSString *)sourceApplication
|
||||
annotation:(id)annotation {
|
||||
|
||||
// Facebook SDK * login flow *
|
||||
// Attempt to handle URLs to complete any auth (e.g., SSO) flow.
|
||||
return [FBAppCall handleOpenURL:url sourceApplication:sourceApplication fallbackHandler:^(FBAppCall *call) {
|
||||
// Facebook SDK * App Linking *
|
||||
// For simplicity, this sample will ignore the link if the session is already
|
||||
// open but a more advanced app could support features like user switching.
|
||||
if (call.accessTokenData) {
|
||||
if ([FBSession activeSession].isOpen) {
|
||||
NSLog(@"INFO: Ignoring app link because current session is open.");
|
||||
}
|
||||
else {
|
||||
[self handleAppLink:call.accessTokenData];
|
||||
}
|
||||
}
|
||||
}];
|
||||
}
|
||||
|
||||
- (void)applicationWillTerminate:(UIApplication *)application {
|
||||
// Facebook SDK * pro-tip *
|
||||
// if the app is going away, we close the session object; this is a good idea because
|
||||
// things may be hanging off the session, that need releasing (completion block, etc.) and
|
||||
// other components in the app may be awaiting close notification in order to do cleanup
|
||||
[FBSession.activeSession close];
|
||||
}
|
||||
|
||||
- (void)applicationDidBecomeActive:(UIApplication *)application {
|
||||
[FBAppEvents activateApp];
|
||||
|
||||
// Facebook SDK * login flow *
|
||||
// We need to properly handle activation of the application with regards to SSO
|
||||
// (e.g., returning from iOS 6.0 authorization dialog or from fast app switching).
|
||||
[FBAppCall handleDidBecomeActive];
|
||||
}
|
||||
|
||||
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
|
||||
// If you have not added the -ObjC linker flag, you may need to uncomment the following line because
|
||||
// Nib files require the type to have been loaded before they can do the wireup successfully.
|
||||
// http://stackoverflow.com/questions/1725881/unknown-class-myclass-in-interface-builder-file-error-at-runtime
|
||||
// [FBProfilePictureView class];
|
||||
|
||||
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
|
||||
[self resetMainViewController];
|
||||
self.loginViewController = [[SCLoginViewController alloc] initWithNibName:@"SCLoginViewController"
|
||||
bundle:nil];
|
||||
self.navigationController = [[UINavigationController alloc] initWithRootViewController:self.loginViewController];
|
||||
self.navigationController.delegate = self;
|
||||
self.window.rootViewController = self.navigationController;
|
||||
|
||||
[self.window makeKeyAndVisible];
|
||||
|
||||
// Facebook SDK * pro-tip *
|
||||
// We take advantage of the `FBLoginView` in our loginViewController, which can
|
||||
// automatically open a session if there is a token cached. If we were not using
|
||||
// that control, this location would be a good place to try to open a session
|
||||
// from a token cache.
|
||||
|
||||
return YES;
|
||||
}
|
||||
|
||||
// Helper method to wrap logic for handling app links.
|
||||
- (void)handleAppLink:(FBAccessTokenData *)appLinkToken {
|
||||
// Initialize a new blank session instance...
|
||||
FBSession *appLinkSession = [[FBSession alloc] initWithAppID:nil
|
||||
permissions:nil
|
||||
defaultAudience:FBSessionDefaultAudienceNone
|
||||
urlSchemeSuffix:nil
|
||||
tokenCacheStrategy:[FBSessionTokenCachingStrategy nullCacheInstance] ];
|
||||
[FBSession setActiveSession:appLinkSession];
|
||||
// ... and open it from the App Link's Token.
|
||||
[appLinkSession openFromAccessTokenData:appLinkToken
|
||||
completionHandler:^(FBSession *session, FBSessionState status, NSError *error) {
|
||||
// Forward any errors to the FBLoginView delegate.
|
||||
if (error) {
|
||||
[self.loginViewController loginView:nil handleError:error];
|
||||
}
|
||||
}];
|
||||
}
|
||||
|
||||
#pragma mark - UINavigationControllerDelegate
|
||||
|
||||
- (void)navigationController:(UINavigationController *)navigationController
|
||||
didShowViewController:(UIViewController *)viewController
|
||||
animated:(BOOL)animated {
|
||||
self.isNavigating = NO;
|
||||
}
|
||||
|
||||
- (void)navigationController:(UINavigationController *)navigationController willShowViewController:(UIViewController *)viewController animated:(BOOL)animated {
|
||||
self.isNavigating = YES;
|
||||
}
|
||||
|
||||
- (void)resetMainViewController {
|
||||
self.mainViewController = [[SCViewController alloc] initWithNibName:@"SCViewController"
|
||||
bundle:nil];
|
||||
#ifdef __IPHONE_7_0
|
||||
if ([self.mainViewController respondsToSelector:@selector(setEdgesForExtendedLayout:)]) {
|
||||
self.mainViewController.edgesForExtendedLayout &= ~UIRectEdgeTop;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,26 @@
|
||||
/*
|
||||
* Copyright 2010-present Facebook.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
#import <FacebookSDK/FacebookSDK.h>
|
||||
|
||||
/*
|
||||
The UIViewController representing the Scrumptious landing page.
|
||||
*/
|
||||
@interface SCLoginViewController : UIViewController<FBLoginViewDelegate>
|
||||
@property (unsafe_unretained, nonatomic) IBOutlet FBLoginView *FBLoginView;
|
||||
- (IBAction)clickSkipLogIn:(id)sender;
|
||||
@end
|
||||
@@ -0,0 +1,155 @@
|
||||
/*
|
||||
* Copyright 2010-present Facebook.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#import "SCLoginViewController.h"
|
||||
#import "SCAppDelegate.h"
|
||||
#import "SCViewController.h"
|
||||
|
||||
@implementation SCLoginViewController
|
||||
|
||||
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
|
||||
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
|
||||
if (self) {
|
||||
// Facebook SDK * pro-tip *
|
||||
// We wire up the FBLoginView using the interface builder
|
||||
// but we could have also explicitly wired its delegate here.
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)viewWillAppear:(BOOL)animated {
|
||||
[super viewWillAppear:animated];
|
||||
|
||||
self.navigationController.navigationBarHidden = YES;
|
||||
}
|
||||
|
||||
- (void)viewDidAppear:(BOOL)animated {
|
||||
[super viewDidAppear:animated];
|
||||
if (self.shouldSkipLogIn) {
|
||||
[self performSelector:@selector(transitionToMainViewController) withObject:nil afterDelay:.5];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)setShouldSkipLogIn:(BOOL)skip {
|
||||
[[NSUserDefaults standardUserDefaults] setBool:skip forKey:@"ScrumptiousSkipLogIn"];
|
||||
[[NSUserDefaults standardUserDefaults] synchronize];
|
||||
}
|
||||
|
||||
- (BOOL)shouldSkipLogIn {
|
||||
return [[NSUserDefaults standardUserDefaults] boolForKey:@"ScrumptiousSkipLogIn"];
|
||||
}
|
||||
|
||||
- (void)viewWillDisappear:(BOOL)animated {
|
||||
self.navigationController.navigationBarHidden = NO;
|
||||
}
|
||||
|
||||
- (void)viewDidUnload {
|
||||
[self setFBLoginView:nil];
|
||||
[super viewDidUnload];
|
||||
}
|
||||
|
||||
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
|
||||
return (interfaceOrientation == UIInterfaceOrientationPortrait);
|
||||
}
|
||||
|
||||
- (void)transitionToMainViewController {
|
||||
// this pop is a noop in some cases, and in others makes sure we don't try
|
||||
// to push the same controller twice
|
||||
[self.navigationController popToRootViewControllerAnimated:NO];
|
||||
|
||||
// Upon login, transition to the main UI by pushing it onto the navigation stack.
|
||||
SCAppDelegate *appDelegate = (SCAppDelegate *)[UIApplication sharedApplication].delegate;
|
||||
[self.navigationController pushViewController:appDelegate.mainViewController animated:YES];
|
||||
}
|
||||
|
||||
#pragma mark - FBLoginView delegate
|
||||
|
||||
- (void)loginViewShowingLoggedInUser:(FBLoginView *)loginView {
|
||||
// if you become logged in, no longer flag to skip log in
|
||||
self.shouldSkipLogIn = NO;
|
||||
[self transitionToMainViewController];
|
||||
}
|
||||
|
||||
- (void)loginView:(FBLoginView *)loginView
|
||||
handleError:(NSError *)error{
|
||||
NSString *alertMessage, *alertTitle;
|
||||
|
||||
// Facebook SDK * error handling *
|
||||
// Error handling is an important part of providing a good user experience.
|
||||
// Since this sample uses the FBLoginView, this delegate will respond to
|
||||
// login failures, or other failures that have closed the session (such
|
||||
// as a token becoming invalid). Please see the [- postOpenGraphAction:]
|
||||
// and [- requestPermissionAndPost] on `SCViewController` for further
|
||||
// error handling on other operations.
|
||||
|
||||
if (error.fberrorShouldNotifyUser) {
|
||||
// If the SDK has a message for the user, surface it. This conveniently
|
||||
// handles cases like password change or iOS6 app slider state.
|
||||
alertTitle = @"Something Went Wrong";
|
||||
alertMessage = error.fberrorUserMessage;
|
||||
} else if (error.fberrorCategory == FBErrorCategoryAuthenticationReopenSession) {
|
||||
// It is important to handle session closures as mentioned. You can inspect
|
||||
// the error for more context but this sample generically notifies the user.
|
||||
alertTitle = @"Session Error";
|
||||
alertMessage = @"Your current session is no longer valid. Please log in again.";
|
||||
} else if (error.fberrorCategory == FBErrorCategoryUserCancelled) {
|
||||
// The user has cancelled a login. You can inspect the error
|
||||
// for more context. For this sample, we will simply ignore it.
|
||||
NSLog(@"user cancelled login");
|
||||
} else {
|
||||
// For simplicity, this sample treats other errors blindly, but you should
|
||||
// refer to https://developers.facebook.com/docs/technical-guides/iossdk/errors/ for more information.
|
||||
alertTitle = @"Unknown Error";
|
||||
alertMessage = @"Error. Please try again later.";
|
||||
NSLog(@"Unexpected error:%@", error);
|
||||
}
|
||||
|
||||
if (alertMessage) {
|
||||
[[[UIAlertView alloc] initWithTitle:alertTitle
|
||||
message:alertMessage
|
||||
delegate:nil
|
||||
cancelButtonTitle:@"OK"
|
||||
otherButtonTitles:nil] show];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)loginViewShowingLoggedOutUser:(FBLoginView *)loginView {
|
||||
// Facebook SDK * login flow *
|
||||
// It is important to always handle session closure because it can happen
|
||||
// externally; for example, if the current session's access token becomes
|
||||
// invalid. For this sample, we simply pop back to the landing page.
|
||||
SCAppDelegate *appDelegate = (SCAppDelegate *)[UIApplication sharedApplication].delegate;
|
||||
if (appDelegate.isNavigating) {
|
||||
// The delay is for the edge case where a session is immediately closed after
|
||||
// logging in and our navigation controller is still animating a push.
|
||||
[self performSelector:@selector(logOut) withObject:nil afterDelay:.5];
|
||||
} else {
|
||||
[self logOut];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)logOut {
|
||||
// on log out we reset the main view controller
|
||||
SCAppDelegate *appDelegate = (SCAppDelegate *)[UIApplication sharedApplication].delegate;
|
||||
[appDelegate resetMainViewController];
|
||||
[self.navigationController popToRootViewControllerAnimated:YES];
|
||||
}
|
||||
|
||||
- (IBAction)clickSkipLogIn:(id)sender {
|
||||
self.shouldSkipLogIn = YES;
|
||||
[self transitionToMainViewController];
|
||||
}
|
||||
@end
|
||||
@@ -0,0 +1,419 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<archive type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="8.00">
|
||||
<data>
|
||||
<int key="IBDocument.SystemTarget">1552</int>
|
||||
<string key="IBDocument.SystemVersion">12E55</string>
|
||||
<string key="IBDocument.InterfaceBuilderVersion">3084</string>
|
||||
<string key="IBDocument.AppKitVersion">1187.39</string>
|
||||
<string key="IBDocument.HIToolboxVersion">626.00</string>
|
||||
<object class="NSMutableDictionary" key="IBDocument.PluginVersions">
|
||||
<string key="NS.key.0">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
||||
<string key="NS.object.0">2083</string>
|
||||
</object>
|
||||
<array key="IBDocument.IntegratedClassDependencies">
|
||||
<string>IBProxyObject</string>
|
||||
<string>IBUIButton</string>
|
||||
<string>IBUIImageView</string>
|
||||
<string>IBUILabel</string>
|
||||
<string>IBUIView</string>
|
||||
</array>
|
||||
<array key="IBDocument.PluginDependencies">
|
||||
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
||||
</array>
|
||||
<object class="NSMutableDictionary" key="IBDocument.Metadata">
|
||||
<string key="NS.key.0">PluginDependencyRecalculationVersion</string>
|
||||
<integer value="1" key="NS.object.0"/>
|
||||
</object>
|
||||
<array class="NSMutableArray" key="IBDocument.RootObjects" id="1000">
|
||||
<object class="IBProxyObject" id="372490531">
|
||||
<string key="IBProxiedObjectIdentifier">IBFilesOwner</string>
|
||||
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
|
||||
</object>
|
||||
<object class="IBProxyObject" id="975951072">
|
||||
<string key="IBProxiedObjectIdentifier">IBFirstResponder</string>
|
||||
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
|
||||
</object>
|
||||
<object class="IBUIView" id="191373211">
|
||||
<reference key="NSNextResponder"/>
|
||||
<int key="NSvFlags">274</int>
|
||||
<array class="NSMutableArray" key="NSSubviews">
|
||||
<object class="IBUIView" id="896580239">
|
||||
<reference key="NSNextResponder" ref="191373211"/>
|
||||
<int key="NSvFlags">301</int>
|
||||
<array class="NSMutableArray" key="NSSubviews">
|
||||
<object class="IBUIView" id="248182986">
|
||||
<reference key="NSNextResponder" ref="896580239"/>
|
||||
<int key="NSvFlags">301</int>
|
||||
<string key="NSFrame">{{-7, 87}, {218, 46}}</string>
|
||||
<reference key="NSSuperview" ref="896580239"/>
|
||||
<reference key="NSWindow"/>
|
||||
<reference key="NSNextKeyView" ref="359402499"/>
|
||||
<string key="NSReuseIdentifierKey">_NS:9</string>
|
||||
<object class="NSColor" key="IBUIBackgroundColor">
|
||||
<int key="NSColorSpace">3</int>
|
||||
<bytes key="NSWhite">MQA</bytes>
|
||||
<object class="NSColorSpace" key="NSCustomColorSpace" id="1026150322">
|
||||
<int key="NSID">2</int>
|
||||
</object>
|
||||
</object>
|
||||
<int key="IBUIContentMode">7</int>
|
||||
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
|
||||
</object>
|
||||
<object class="IBUILabel" id="599947327">
|
||||
<reference key="NSNextResponder" ref="896580239"/>
|
||||
<int key="NSvFlags">317</int>
|
||||
<string key="NSFrame">{{15, 20}, {174, 59}}</string>
|
||||
<reference key="NSSuperview" ref="896580239"/>
|
||||
<reference key="NSWindow"/>
|
||||
<reference key="NSNextKeyView" ref="248182986"/>
|
||||
<string key="NSReuseIdentifierKey">_NS:9</string>
|
||||
<bool key="IBUIOpaque">NO</bool>
|
||||
<bool key="IBUIClipsSubviews">YES</bool>
|
||||
<int key="IBUIContentMode">7</int>
|
||||
<bool key="IBUIUserInteractionEnabled">NO</bool>
|
||||
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
|
||||
<string key="IBUIText">Start sharing meals you eat</string>
|
||||
<object class="NSColor" key="IBUITextColor">
|
||||
<int key="NSColorSpace">1</int>
|
||||
<bytes key="NSRGB">MC45NDM4Nzc1NTEgMC45NDM4Nzc1NTEgMC45NDM4Nzc1NTEAA</bytes>
|
||||
</object>
|
||||
<nil key="IBUIHighlightedColor"/>
|
||||
<int key="IBUIBaselineAdjustment">0</int>
|
||||
<float key="IBUIMinimumFontSize">10</float>
|
||||
<int key="IBUINumberOfLines">0</int>
|
||||
<int key="IBUITextAlignment">1</int>
|
||||
<object class="IBUIFontDescription" key="IBUIFontDescription">
|
||||
<int key="type">1</int>
|
||||
<double key="pointSize">17</double>
|
||||
</object>
|
||||
<object class="NSFont" key="IBUIFont">
|
||||
<string key="NSName">Helvetica</string>
|
||||
<double key="NSSize">17</double>
|
||||
<int key="NSfFlags">16</int>
|
||||
</object>
|
||||
<double key="preferredMaxLayoutWidth">174</double>
|
||||
</object>
|
||||
<object class="IBUIButton" id="359402499">
|
||||
<reference key="NSNextResponder" ref="896580239"/>
|
||||
<int key="NSvFlags">301</int>
|
||||
<string key="NSFrame">{{12, 147}, {180, 23}}</string>
|
||||
<reference key="NSSuperview" ref="896580239"/>
|
||||
<reference key="NSWindow"/>
|
||||
<reference key="NSNextKeyView"/>
|
||||
<string key="NSReuseIdentifierKey">_NS:9</string>
|
||||
<bool key="IBUIOpaque">NO</bool>
|
||||
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
|
||||
<int key="IBUIContentHorizontalAlignment">0</int>
|
||||
<int key="IBUIContentVerticalAlignment">0</int>
|
||||
<string key="IBUINormalTitle">(Or click here to skip login)</string>
|
||||
<object class="NSColor" key="IBUINormalTitleColor" id="269655657">
|
||||
<int key="NSColorSpace">3</int>
|
||||
<bytes key="NSWhite">MQA</bytes>
|
||||
</object>
|
||||
<reference key="IBUINormalTitleShadowColor" ref="269655657"/>
|
||||
<object class="IBUIFontDescription" key="IBUIFontDescription">
|
||||
<string key="name">Helvetica</string>
|
||||
<string key="family">Helvetica</string>
|
||||
<int key="traits">0</int>
|
||||
<double key="pointSize">13</double>
|
||||
</object>
|
||||
<object class="NSFont" key="IBUIFont">
|
||||
<string key="NSName">Helvetica</string>
|
||||
<double key="NSSize">13</double>
|
||||
<int key="NSfFlags">16</int>
|
||||
</object>
|
||||
</object>
|
||||
</array>
|
||||
<string key="NSFrame">{{58, 115}, {204, 176}}</string>
|
||||
<reference key="NSSuperview" ref="191373211"/>
|
||||
<reference key="NSWindow"/>
|
||||
<reference key="NSNextKeyView" ref="599947327"/>
|
||||
<string key="NSReuseIdentifierKey">_NS:9</string>
|
||||
<object class="NSColor" key="IBUIBackgroundColor">
|
||||
<int key="NSColorSpace">3</int>
|
||||
<bytes key="NSWhite">MSAwAA</bytes>
|
||||
<reference key="NSCustomColorSpace" ref="1026150322"/>
|
||||
</object>
|
||||
<bool key="IBUIOpaque">NO</bool>
|
||||
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
|
||||
</object>
|
||||
<object class="IBUIView" id="481110768">
|
||||
<reference key="NSNextResponder" ref="191373211"/>
|
||||
<int key="NSvFlags">293</int>
|
||||
<array class="NSMutableArray" key="NSSubviews">
|
||||
<object class="IBUILabel" id="144313356">
|
||||
<reference key="NSNextResponder" ref="481110768"/>
|
||||
<int key="NSvFlags">292</int>
|
||||
<string key="NSFrame">{{102, 11}, {193, 86}}</string>
|
||||
<reference key="NSSuperview" ref="481110768"/>
|
||||
<reference key="NSWindow"/>
|
||||
<reference key="NSNextKeyView" ref="896580239"/>
|
||||
<string key="NSReuseIdentifierKey">_NS:9</string>
|
||||
<bool key="IBUIOpaque">NO</bool>
|
||||
<bool key="IBUIClipsSubviews">YES</bool>
|
||||
<int key="IBUIContentMode">7</int>
|
||||
<bool key="IBUIUserInteractionEnabled">NO</bool>
|
||||
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
|
||||
<string key="IBUIText">Scrumptious</string>
|
||||
<object class="NSColor" key="IBUITextColor">
|
||||
<int key="NSColorSpace">1</int>
|
||||
<bytes key="NSRGB">MC41Mzk4MDc4MDE2IDAuODQ0ODc3OTU3OSAxAA</bytes>
|
||||
</object>
|
||||
<nil key="IBUIHighlightedColor"/>
|
||||
<int key="IBUIBaselineAdjustment">0</int>
|
||||
<float key="IBUIMinimumFontSize">10</float>
|
||||
<object class="IBUIFontDescription" key="IBUIFontDescription">
|
||||
<string key="name">Zapfino</string>
|
||||
<string key="family">Zapfino</string>
|
||||
<int key="traits">1</int>
|
||||
<double key="pointSize">28</double>
|
||||
</object>
|
||||
<object class="NSFont" key="IBUIFont">
|
||||
<string key="NSName">Zapfino</string>
|
||||
<double key="NSSize">28</double>
|
||||
<int key="NSfFlags">16</int>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBUIImageView" id="113215792">
|
||||
<reference key="NSNextResponder" ref="481110768"/>
|
||||
<int key="NSvFlags">292</int>
|
||||
<string key="NSFrame">{{20, 17}, {74, 74}}</string>
|
||||
<reference key="NSSuperview" ref="481110768"/>
|
||||
<reference key="NSWindow"/>
|
||||
<reference key="NSNextKeyView" ref="144313356"/>
|
||||
<string key="NSReuseIdentifierKey">_NS:9</string>
|
||||
<int key="IBUIContentMode">4</int>
|
||||
<bool key="IBUIUserInteractionEnabled">NO</bool>
|
||||
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
|
||||
<object class="NSCustomResource" key="IBUIImage">
|
||||
<string key="NSClassName">NSImage</string>
|
||||
<string key="NSResourceName">Icon-72.png</string>
|
||||
</object>
|
||||
</object>
|
||||
</array>
|
||||
<string key="NSFrame">{{9, 0}, {302, 107}}</string>
|
||||
<reference key="NSSuperview" ref="191373211"/>
|
||||
<reference key="NSWindow"/>
|
||||
<reference key="NSNextKeyView" ref="113215792"/>
|
||||
<string key="NSReuseIdentifierKey">_NS:9</string>
|
||||
<object class="NSColor" key="IBUIBackgroundColor">
|
||||
<int key="NSColorSpace">3</int>
|
||||
<bytes key="NSWhite">MSAwAA</bytes>
|
||||
<reference key="NSCustomColorSpace" ref="1026150322"/>
|
||||
</object>
|
||||
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
|
||||
</object>
|
||||
</array>
|
||||
<string key="NSFrame">{{0, 20}, {320, 460}}</string>
|
||||
<reference key="NSSuperview"/>
|
||||
<reference key="NSWindow"/>
|
||||
<reference key="NSNextKeyView" ref="481110768"/>
|
||||
<object class="NSColor" key="IBUIBackgroundColor">
|
||||
<int key="NSColorSpace">2</int>
|
||||
<bytes key="NSRGB">MC4yMzEzNzI1NjUgMC4zNDkwMTk2MTY4IDAuNTk2MDc4NDU1NAA</bytes>
|
||||
</object>
|
||||
<object class="IBUISimulatedStatusBarMetrics" key="IBUISimulatedStatusBarMetrics"/>
|
||||
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
|
||||
</object>
|
||||
</array>
|
||||
<object class="IBObjectContainer" key="IBDocument.Objects">
|
||||
<array class="NSMutableArray" key="connectionRecords">
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBCocoaTouchOutletConnection" key="connection">
|
||||
<string key="label">view</string>
|
||||
<reference key="source" ref="372490531"/>
|
||||
<reference key="destination" ref="191373211"/>
|
||||
</object>
|
||||
<int key="connectionID">3</int>
|
||||
</object>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBCocoaTouchOutletConnection" key="connection">
|
||||
<string key="label">FBLoginView</string>
|
||||
<reference key="source" ref="372490531"/>
|
||||
<reference key="destination" ref="248182986"/>
|
||||
</object>
|
||||
<int key="connectionID">14</int>
|
||||
</object>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBCocoaTouchOutletConnection" key="connection">
|
||||
<string key="label">delegate</string>
|
||||
<reference key="source" ref="248182986"/>
|
||||
<reference key="destination" ref="372490531"/>
|
||||
</object>
|
||||
<int key="connectionID">15</int>
|
||||
</object>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBCocoaTouchEventConnection" key="connection">
|
||||
<string key="label">clickSkipLogIn:</string>
|
||||
<reference key="source" ref="359402499"/>
|
||||
<reference key="destination" ref="372490531"/>
|
||||
<int key="IBEventType">7</int>
|
||||
</object>
|
||||
<int key="connectionID">20</int>
|
||||
</object>
|
||||
</array>
|
||||
<object class="IBMutableOrderedSet" key="objectRecords">
|
||||
<array key="orderedObjects">
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">0</int>
|
||||
<array key="object" id="0"/>
|
||||
<reference key="children" ref="1000"/>
|
||||
<nil key="parent"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">1</int>
|
||||
<reference key="object" ref="191373211"/>
|
||||
<array class="NSMutableArray" key="children">
|
||||
<reference ref="481110768"/>
|
||||
<reference ref="896580239"/>
|
||||
</array>
|
||||
<reference key="parent" ref="0"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">-1</int>
|
||||
<reference key="object" ref="372490531"/>
|
||||
<reference key="parent" ref="0"/>
|
||||
<string key="objectName">File's Owner</string>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">-2</int>
|
||||
<reference key="object" ref="975951072"/>
|
||||
<reference key="parent" ref="0"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">17</int>
|
||||
<reference key="object" ref="896580239"/>
|
||||
<array class="NSMutableArray" key="children">
|
||||
<reference ref="599947327"/>
|
||||
<reference ref="359402499"/>
|
||||
<reference ref="248182986"/>
|
||||
</array>
|
||||
<reference key="parent" ref="191373211"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">4</int>
|
||||
<reference key="object" ref="599947327"/>
|
||||
<reference key="parent" ref="896580239"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">18</int>
|
||||
<reference key="object" ref="481110768"/>
|
||||
<array class="NSMutableArray" key="children">
|
||||
<reference ref="144313356"/>
|
||||
<reference ref="113215792"/>
|
||||
</array>
|
||||
<reference key="parent" ref="191373211"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">6</int>
|
||||
<reference key="object" ref="144313356"/>
|
||||
<reference key="parent" ref="481110768"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">5</int>
|
||||
<reference key="object" ref="113215792"/>
|
||||
<reference key="parent" ref="481110768"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">19</int>
|
||||
<reference key="object" ref="359402499"/>
|
||||
<reference key="parent" ref="896580239"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">13</int>
|
||||
<reference key="object" ref="248182986"/>
|
||||
<reference key="parent" ref="896580239"/>
|
||||
</object>
|
||||
</array>
|
||||
</object>
|
||||
<dictionary class="NSMutableDictionary" key="flattenedProperties">
|
||||
<string key="-1.CustomClassName">SCLoginViewController</string>
|
||||
<string key="-1.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
||||
<string key="-2.CustomClassName">UIResponder</string>
|
||||
<string key="-2.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
||||
<string key="1.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
||||
<string key="13.CustomClassName">FBLoginView</string>
|
||||
<string key="13.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
||||
<string key="17.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
||||
<string key="18.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
||||
<string key="19.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
||||
<real value="0.0" key="19.IBUIButtonInspectorSelectedEdgeInsetMetadataKey"/>
|
||||
<real value="0.0" key="19.IBUIButtonInspectorSelectedStateConfigurationMetadataKey"/>
|
||||
<string key="4.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
||||
<string key="5.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
||||
<string key="6.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
||||
</dictionary>
|
||||
<dictionary class="NSMutableDictionary" key="unlocalizedProperties"/>
|
||||
<nil key="activeLocalization"/>
|
||||
<dictionary class="NSMutableDictionary" key="localizations"/>
|
||||
<nil key="sourceID"/>
|
||||
<int key="maxID">34</int>
|
||||
</object>
|
||||
<object class="IBClassDescriber" key="IBDocument.Classes">
|
||||
<array class="NSMutableArray" key="referencedPartialClassDescriptions">
|
||||
<object class="IBPartialClassDescription">
|
||||
<string key="className">FBLoginView</string>
|
||||
<string key="superclassName">UIView</string>
|
||||
<object class="NSMutableDictionary" key="outlets">
|
||||
<string key="NS.key.0">delegate</string>
|
||||
<string key="NS.object.0">id</string>
|
||||
</object>
|
||||
<object class="NSMutableDictionary" key="toOneOutletInfosByName">
|
||||
<string key="NS.key.0">delegate</string>
|
||||
<object class="IBToOneOutletInfo" key="NS.object.0">
|
||||
<string key="name">delegate</string>
|
||||
<string key="candidateClassName">id</string>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||
<string key="majorKey">IBProjectSource</string>
|
||||
<string key="minorKey">./Classes/FBLoginView.h</string>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBPartialClassDescription">
|
||||
<string key="className">SCLoginViewController</string>
|
||||
<string key="superclassName">UIViewController</string>
|
||||
<object class="NSMutableDictionary" key="actions">
|
||||
<string key="NS.key.0">clickSkipLogIn:</string>
|
||||
<string key="NS.object.0">id</string>
|
||||
</object>
|
||||
<object class="NSMutableDictionary" key="actionInfosByName">
|
||||
<string key="NS.key.0">clickSkipLogIn:</string>
|
||||
<object class="IBActionInfo" key="NS.object.0">
|
||||
<string key="name">clickSkipLogIn:</string>
|
||||
<string key="candidateClassName">id</string>
|
||||
</object>
|
||||
</object>
|
||||
<object class="NSMutableDictionary" key="outlets">
|
||||
<string key="NS.key.0">FBLoginView</string>
|
||||
<string key="NS.object.0">FBLoginView</string>
|
||||
</object>
|
||||
<object class="NSMutableDictionary" key="toOneOutletInfosByName">
|
||||
<string key="NS.key.0">FBLoginView</string>
|
||||
<object class="IBToOneOutletInfo" key="NS.object.0">
|
||||
<string key="name">FBLoginView</string>
|
||||
<string key="candidateClassName">FBLoginView</string>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||
<string key="majorKey">IBProjectSource</string>
|
||||
<string key="minorKey">./Classes/SCLoginViewController.h</string>
|
||||
</object>
|
||||
</object>
|
||||
</array>
|
||||
</object>
|
||||
<int key="IBDocument.localizationMode">0</int>
|
||||
<string key="IBDocument.TargetRuntimeIdentifier">IBCocoaTouchFramework</string>
|
||||
<object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDependencyDefaults">
|
||||
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS</string>
|
||||
<real value="1552" key="NS.object.0"/>
|
||||
</object>
|
||||
<bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool>
|
||||
<int key="IBDocument.defaultPropertyAccessControl">3</int>
|
||||
<object class="NSMutableDictionary" key="IBDocument.LastKnownImageSizes">
|
||||
<string key="NS.key.0">Icon-72.png</string>
|
||||
<string key="NS.object.0">{72, 72}</string>
|
||||
</object>
|
||||
<string key="IBCocoaTouchPluginVersion">2083</string>
|
||||
</data>
|
||||
</archive>
|
||||
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
* Copyright 2010-present Facebook.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
#import "SCViewController.h"
|
||||
|
||||
typedef void(^ConfirmCallback)(id sender, bool confirm);
|
||||
|
||||
@interface SCPhotoViewController : UIViewController
|
||||
|
||||
@property (strong, nonatomic) IBOutlet UIImageView *imageView;
|
||||
@property (copy, nonatomic) ConfirmCallback confirmCallback;
|
||||
@property (strong, readonly) UIImage* image;
|
||||
|
||||
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil image:(UIImage *)anImage;
|
||||
- (IBAction)confirm:(id)sender;
|
||||
- (IBAction)cancel:(id)sender;
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,79 @@
|
||||
/*
|
||||
* Copyright 2010-present Facebook
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#import "SCPhotoViewController.h"
|
||||
|
||||
@interface SCPhotoViewController ()
|
||||
|
||||
@property (strong, readwrite) UIImage* image;
|
||||
|
||||
@end
|
||||
|
||||
@implementation SCPhotoViewController
|
||||
|
||||
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil image:(UIImage *) anImage
|
||||
{
|
||||
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
|
||||
if (self) {
|
||||
self.image = anImage;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)viewDidLoad
|
||||
{
|
||||
[super viewDidLoad];
|
||||
[self.imageView setImage:self.image];
|
||||
}
|
||||
|
||||
- (void)viewDidUnload
|
||||
{
|
||||
[super viewDidUnload];
|
||||
self.imageView = nil;
|
||||
self.image = nil;
|
||||
}
|
||||
|
||||
- (void)viewWillAppear:(BOOL)animated {
|
||||
[super viewWillAppear:animated];
|
||||
|
||||
self.navigationController.navigationBarHidden = YES;
|
||||
}
|
||||
|
||||
- (void)viewWillDisappear:(BOOL)animated {
|
||||
self.navigationController.navigationBarHidden = NO;
|
||||
|
||||
[super viewWillDisappear:animated];
|
||||
}
|
||||
|
||||
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
|
||||
{
|
||||
return (interfaceOrientation == UIInterfaceOrientationPortrait);
|
||||
}
|
||||
|
||||
- (IBAction)confirm:(id)sender {
|
||||
if (self.confirmCallback) {
|
||||
self.confirmCallback(self, YES);
|
||||
}
|
||||
[self.navigationController popViewControllerAnimated:YES];
|
||||
}
|
||||
|
||||
- (IBAction)cancel:(id)sender {
|
||||
if (self.confirmCallback) {
|
||||
self.confirmCallback(self, NO);
|
||||
}
|
||||
[self.navigationController popViewControllerAnimated:YES];
|
||||
}
|
||||
@end
|
||||
@@ -0,0 +1,264 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<archive type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="8.00">
|
||||
<data>
|
||||
<int key="IBDocument.SystemTarget">1296</int>
|
||||
<string key="IBDocument.SystemVersion">11E53</string>
|
||||
<string key="IBDocument.InterfaceBuilderVersion">2182</string>
|
||||
<string key="IBDocument.AppKitVersion">1138.47</string>
|
||||
<string key="IBDocument.HIToolboxVersion">569.00</string>
|
||||
<object class="NSMutableDictionary" key="IBDocument.PluginVersions">
|
||||
<string key="NS.key.0">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
||||
<string key="NS.object.0">1181</string>
|
||||
</object>
|
||||
<array key="IBDocument.IntegratedClassDependencies">
|
||||
<string>IBUIBarButtonItem</string>
|
||||
<string>IBUIToolbar</string>
|
||||
<string>IBUIImageView</string>
|
||||
<string>IBUIView</string>
|
||||
<string>IBProxyObject</string>
|
||||
</array>
|
||||
<array key="IBDocument.PluginDependencies">
|
||||
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
||||
</array>
|
||||
<object class="NSMutableDictionary" key="IBDocument.Metadata">
|
||||
<string key="NS.key.0">PluginDependencyRecalculationVersion</string>
|
||||
<integer value="1" key="NS.object.0"/>
|
||||
</object>
|
||||
<array class="NSMutableArray" key="IBDocument.RootObjects" id="1000">
|
||||
<object class="IBProxyObject" id="372490531">
|
||||
<string key="IBProxiedObjectIdentifier">IBFilesOwner</string>
|
||||
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
|
||||
</object>
|
||||
<object class="IBProxyObject" id="975951072">
|
||||
<string key="IBProxiedObjectIdentifier">IBFirstResponder</string>
|
||||
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
|
||||
</object>
|
||||
<object class="IBUIView" id="191373211">
|
||||
<reference key="NSNextResponder"/>
|
||||
<int key="NSvFlags">274</int>
|
||||
<array class="NSMutableArray" key="NSSubviews">
|
||||
<object class="IBUIImageView" id="591773404">
|
||||
<reference key="NSNextResponder" ref="191373211"/>
|
||||
<int key="NSvFlags">274</int>
|
||||
<string key="NSFrameSize">{320, 416}</string>
|
||||
<reference key="NSSuperview" ref="191373211"/>
|
||||
<reference key="NSWindow"/>
|
||||
<reference key="NSNextKeyView" ref="49911555"/>
|
||||
<string key="NSReuseIdentifierKey">_NS:9</string>
|
||||
<object class="NSColor" key="IBUIBackgroundColor">
|
||||
<int key="NSColorSpace">1</int>
|
||||
<bytes key="NSRGB">MCAwIDAAA</bytes>
|
||||
</object>
|
||||
<int key="IBUIContentMode">1</int>
|
||||
<bool key="IBUIUserInteractionEnabled">NO</bool>
|
||||
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
|
||||
</object>
|
||||
<object class="IBUIToolbar" id="49911555">
|
||||
<reference key="NSNextResponder" ref="191373211"/>
|
||||
<int key="NSvFlags">266</int>
|
||||
<string key="NSFrame">{{0, 416}, {320, 44}}</string>
|
||||
<reference key="NSSuperview" ref="191373211"/>
|
||||
<reference key="NSWindow"/>
|
||||
<reference key="NSNextKeyView"/>
|
||||
<string key="NSReuseIdentifierKey">_NS:9</string>
|
||||
<bool key="IBUIOpaque">NO</bool>
|
||||
<bool key="IBUIClearsContextBeforeDrawing">NO</bool>
|
||||
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
|
||||
<int key="IBUIBarStyle">1</int>
|
||||
<array class="NSMutableArray" key="IBUIItems">
|
||||
<object class="IBUIBarButtonItem" id="732246703">
|
||||
<string key="IBUITitle">Cancel</string>
|
||||
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
|
||||
<int key="IBUIStyle">1</int>
|
||||
<reference key="IBUIToolbar" ref="49911555"/>
|
||||
</object>
|
||||
<object class="IBUIBarButtonItem" id="715513567">
|
||||
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
|
||||
<reference key="IBUIToolbar" ref="49911555"/>
|
||||
<int key="IBUISystemItemIdentifier">5</int>
|
||||
</object>
|
||||
<object class="IBUIBarButtonItem" id="54707360">
|
||||
<string key="IBUITitle">Confirm</string>
|
||||
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
|
||||
<int key="IBUIStyle">1</int>
|
||||
<reference key="IBUIToolbar" ref="49911555"/>
|
||||
</object>
|
||||
</array>
|
||||
</object>
|
||||
</array>
|
||||
<string key="NSFrame">{{0, 20}, {320, 460}}</string>
|
||||
<reference key="NSSuperview"/>
|
||||
<reference key="NSWindow"/>
|
||||
<reference key="NSNextKeyView" ref="591773404"/>
|
||||
<object class="NSColor" key="IBUIBackgroundColor">
|
||||
<int key="NSColorSpace">3</int>
|
||||
<bytes key="NSWhite">MQA</bytes>
|
||||
<object class="NSColorSpace" key="NSCustomColorSpace">
|
||||
<int key="NSID">2</int>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBUISimulatedStatusBarMetrics" key="IBUISimulatedStatusBarMetrics"/>
|
||||
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
|
||||
</object>
|
||||
</array>
|
||||
<object class="IBObjectContainer" key="IBDocument.Objects">
|
||||
<array class="NSMutableArray" key="connectionRecords">
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBCocoaTouchOutletConnection" key="connection">
|
||||
<string key="label">view</string>
|
||||
<reference key="source" ref="372490531"/>
|
||||
<reference key="destination" ref="191373211"/>
|
||||
</object>
|
||||
<int key="connectionID">3</int>
|
||||
</object>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBCocoaTouchOutletConnection" key="connection">
|
||||
<string key="label">imageView</string>
|
||||
<reference key="source" ref="372490531"/>
|
||||
<reference key="destination" ref="591773404"/>
|
||||
</object>
|
||||
<int key="connectionID">29</int>
|
||||
</object>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBCocoaTouchEventConnection" key="connection">
|
||||
<string key="label">cancel:</string>
|
||||
<reference key="source" ref="732246703"/>
|
||||
<reference key="destination" ref="372490531"/>
|
||||
</object>
|
||||
<int key="connectionID">26</int>
|
||||
</object>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBCocoaTouchEventConnection" key="connection">
|
||||
<string key="label">confirm:</string>
|
||||
<reference key="source" ref="54707360"/>
|
||||
<reference key="destination" ref="372490531"/>
|
||||
</object>
|
||||
<int key="connectionID">23</int>
|
||||
</object>
|
||||
</array>
|
||||
<object class="IBMutableOrderedSet" key="objectRecords">
|
||||
<array key="orderedObjects">
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">0</int>
|
||||
<array key="object" id="0"/>
|
||||
<reference key="children" ref="1000"/>
|
||||
<nil key="parent"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">1</int>
|
||||
<reference key="object" ref="191373211"/>
|
||||
<array class="NSMutableArray" key="children">
|
||||
<reference ref="591773404"/>
|
||||
<reference ref="49911555"/>
|
||||
</array>
|
||||
<reference key="parent" ref="0"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">-1</int>
|
||||
<reference key="object" ref="372490531"/>
|
||||
<reference key="parent" ref="0"/>
|
||||
<string key="objectName">File's Owner</string>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">-2</int>
|
||||
<reference key="object" ref="975951072"/>
|
||||
<reference key="parent" ref="0"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">4</int>
|
||||
<reference key="object" ref="591773404"/>
|
||||
<reference key="parent" ref="191373211"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">7</int>
|
||||
<reference key="object" ref="49911555"/>
|
||||
<array class="NSMutableArray" key="children">
|
||||
<reference ref="732246703"/>
|
||||
<reference ref="54707360"/>
|
||||
<reference ref="715513567"/>
|
||||
</array>
|
||||
<reference key="parent" ref="191373211"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">9</int>
|
||||
<reference key="object" ref="54707360"/>
|
||||
<reference key="parent" ref="49911555"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">8</int>
|
||||
<reference key="object" ref="732246703"/>
|
||||
<reference key="parent" ref="49911555"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">28</int>
|
||||
<reference key="object" ref="715513567"/>
|
||||
<reference key="parent" ref="49911555"/>
|
||||
</object>
|
||||
</array>
|
||||
</object>
|
||||
<dictionary class="NSMutableDictionary" key="flattenedProperties">
|
||||
<string key="-1.CustomClassName">SCPhotoViewController</string>
|
||||
<string key="-1.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
||||
<string key="-2.CustomClassName">UIResponder</string>
|
||||
<string key="-2.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
||||
<string key="1.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
||||
<string key="28.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
||||
<string key="4.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
||||
<string key="7.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
||||
<string key="8.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
||||
<string key="9.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
||||
</dictionary>
|
||||
<dictionary class="NSMutableDictionary" key="unlocalizedProperties"/>
|
||||
<nil key="activeLocalization"/>
|
||||
<dictionary class="NSMutableDictionary" key="localizations"/>
|
||||
<nil key="sourceID"/>
|
||||
<int key="maxID">29</int>
|
||||
</object>
|
||||
<object class="IBClassDescriber" key="IBDocument.Classes">
|
||||
<array class="NSMutableArray" key="referencedPartialClassDescriptions">
|
||||
<object class="IBPartialClassDescription">
|
||||
<string key="className">SCPhotoViewController</string>
|
||||
<string key="superclassName">UIViewController</string>
|
||||
<dictionary class="NSMutableDictionary" key="actions">
|
||||
<string key="cancel:">id</string>
|
||||
<string key="confirm:">id</string>
|
||||
</dictionary>
|
||||
<dictionary class="NSMutableDictionary" key="actionInfosByName">
|
||||
<object class="IBActionInfo" key="cancel:">
|
||||
<string key="name">cancel:</string>
|
||||
<string key="candidateClassName">id</string>
|
||||
</object>
|
||||
<object class="IBActionInfo" key="confirm:">
|
||||
<string key="name">confirm:</string>
|
||||
<string key="candidateClassName">id</string>
|
||||
</object>
|
||||
</dictionary>
|
||||
<object class="NSMutableDictionary" key="outlets">
|
||||
<string key="NS.key.0">imageView</string>
|
||||
<string key="NS.object.0">UIImageView</string>
|
||||
</object>
|
||||
<object class="NSMutableDictionary" key="toOneOutletInfosByName">
|
||||
<string key="NS.key.0">imageView</string>
|
||||
<object class="IBToOneOutletInfo" key="NS.object.0">
|
||||
<string key="name">imageView</string>
|
||||
<string key="candidateClassName">UIImageView</string>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||
<string key="majorKey">IBProjectSource</string>
|
||||
<string key="minorKey">./Classes/SCPhotoViewController.h</string>
|
||||
</object>
|
||||
</object>
|
||||
</array>
|
||||
</object>
|
||||
<int key="IBDocument.localizationMode">0</int>
|
||||
<string key="IBDocument.TargetRuntimeIdentifier">IBCocoaTouchFramework</string>
|
||||
<object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDependencyDefaults">
|
||||
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS</string>
|
||||
<real value="1296" key="NS.object.0"/>
|
||||
</object>
|
||||
<bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool>
|
||||
<int key="IBDocument.defaultPropertyAccessControl">3</int>
|
||||
<string key="IBCocoaTouchPluginVersion">1181</string>
|
||||
</data>
|
||||
</archive>
|
||||
@@ -0,0 +1,38 @@
|
||||
/*
|
||||
* Copyright 2010-present Facebook.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <FacebookSDK/FacebookSDK.h>
|
||||
|
||||
// Wraps an Open Graph object (of type "scrumps:meal") that has just two properties,
|
||||
// an ID and a URL. The FBGraphObject allows us to create an FBGraphObject instance
|
||||
// and treat it as an SCOGMeal with typed property accessors.
|
||||
@protocol SCOGMeal<FBGraphObject>
|
||||
|
||||
@property (retain, nonatomic) NSString *id;
|
||||
@property (retain, nonatomic) NSString *url;
|
||||
|
||||
@end
|
||||
|
||||
// Wraps an Open Graph object (of type "scrumps:eat") with a relationship to a meal,
|
||||
// as well as properties inherited from FBOpenGraphAction such as "place" and "tags".
|
||||
@protocol SCOGEatMealAction<FBOpenGraphAction>
|
||||
|
||||
@property (retain, nonatomic) id<SCOGMeal> meal;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
/*
|
||||
* Copyright 2010-present Facebook.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
#import <QuartzCore/QuartzCore.h>
|
||||
#import <FacebookSDK/FacebookSDK.h>
|
||||
|
||||
/*
|
||||
The UIViewController representing the main UI, which
|
||||
lets the user select a type of food, tag who they
|
||||
are with, and where they are.
|
||||
*/
|
||||
@interface SCViewController : UIViewController <FBUserSettingsDelegate, UIAlertViewDelegate>
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,886 @@
|
||||
/*
|
||||
* Copyright 2010-present Facebook.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#import "SCViewController.h"
|
||||
#import "SCAppDelegate.h"
|
||||
#import "SCLoginViewController.h"
|
||||
#import "SCProtocols.h"
|
||||
#import <AddressBook/AddressBook.h>
|
||||
#import "TargetConditionals.h"
|
||||
#import "SCPhotoViewController.h"
|
||||
|
||||
@interface SCViewController() < UITableViewDataSource,
|
||||
UIImagePickerControllerDelegate,
|
||||
FBFriendPickerDelegate,
|
||||
UINavigationControllerDelegate,
|
||||
FBPlacePickerDelegate,
|
||||
CLLocationManagerDelegate,
|
||||
UIActionSheetDelegate> {
|
||||
@private int _retryCount;
|
||||
}
|
||||
|
||||
@property (strong, nonatomic) FBUserSettingsViewController *settingsViewController;
|
||||
@property (strong, nonatomic) IBOutlet FBProfilePictureView *userProfileImage;
|
||||
@property (strong, nonatomic) IBOutlet UILabel *userNameLabel;
|
||||
@property (strong, nonatomic) IBOutlet UIButton *announceButton;
|
||||
@property (strong, nonatomic) IBOutlet UITableView *menuTableView;
|
||||
@property (strong, nonatomic) UIActionSheet *mealPickerActionSheet;
|
||||
@property (retain, nonatomic) NSArray *mealTypes;
|
||||
|
||||
@property (strong, nonatomic) NSObject<FBGraphPlace> *selectedPlace;
|
||||
@property (strong, nonatomic) NSString *selectedMeal;
|
||||
@property (strong, nonatomic) NSArray *selectedFriends;
|
||||
@property (strong, nonatomic) CLLocationManager *locationManager;
|
||||
@property (strong, nonatomic) FBCacheDescriptor *placeCacheDescriptor;
|
||||
@property (strong, nonatomic) UIActivityIndicatorView *activityIndicator;
|
||||
|
||||
@property (strong, nonatomic) UIImagePickerController *imagePicker;
|
||||
@property (strong, nonatomic) UIActionSheet *imagePickerActionSheet;
|
||||
@property (strong, nonatomic) UIImage *selectedPhoto;
|
||||
@property (strong, nonatomic) UIPopoverController *popover;
|
||||
@property (strong, nonatomic) SCPhotoViewController *photoViewController;
|
||||
@property (nonatomic) CGRect popoverFromRect;
|
||||
|
||||
@end
|
||||
|
||||
@implementation SCViewController
|
||||
|
||||
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
|
||||
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
|
||||
if (self) {
|
||||
// Custom initialization
|
||||
self.navigationItem.hidesBackButton = YES;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
#pragma mark - Open Graph Helpers
|
||||
|
||||
// This is a helper function that returns an FBGraphObject representing a meal
|
||||
- (id<SCOGMeal>)mealObjectForMeal:(NSString *)meal {
|
||||
|
||||
// We create an FBGraphObject object, but we can treat it as an SCOGMeal with typed
|
||||
// properties, etc. See <FacebookSDK/FBGraphObject.h> for more details.
|
||||
id<SCOGMeal> result = (id<SCOGMeal>)[FBGraphObject graphObject];
|
||||
|
||||
// Give it a URL of sample data that contains the object's name, title, description, and body.
|
||||
// These OG object URLs were created using the edit open graph feature of the graph tool
|
||||
// at https://www.developers.facebook.com/apps/
|
||||
if ([meal isEqualToString:@"Cheeseburger"]) {
|
||||
result.url = @"http://samples.ogp.me/314483151980285";
|
||||
} else if ([meal isEqualToString:@"Pizza"]) {
|
||||
result.url = @"http://samples.ogp.me/314483221980278";
|
||||
} else if ([meal isEqualToString:@"Hotdog"]) {
|
||||
result.url = @"http://samples.ogp.me/314483265313607";
|
||||
} else if ([meal isEqualToString:@"Italian"]) {
|
||||
result.url = @"http://samples.ogp.me/314483348646932";
|
||||
} else if ([meal isEqualToString:@"French"]) {
|
||||
result.url = @"http://samples.ogp.me/314483375313596";
|
||||
} else if ([meal isEqualToString:@"Chinese"]) {
|
||||
result.url = @"http://samples.ogp.me/314483421980258";
|
||||
} else if ([meal isEqualToString:@"Thai"]) {
|
||||
result.url = @"http://samples.ogp.me/314483451980255";
|
||||
} else if ([meal isEqualToString:@"Indian"]) {
|
||||
result.url = @"http://samples.ogp.me/314483491980251";
|
||||
} else {
|
||||
return nil;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
- (void)enableUserInteraction:(BOOL) enabled {
|
||||
if (enabled) {
|
||||
[self.activityIndicator stopAnimating];
|
||||
} else {
|
||||
[self centerAndShowActivityIndicator];
|
||||
}
|
||||
|
||||
self.announceButton.enabled = enabled;
|
||||
[self.view setUserInteractionEnabled:enabled];
|
||||
}
|
||||
|
||||
- (id<SCOGEatMealAction>)actionFromMealInfo {
|
||||
// Create an Open Graph eat action with the meal, our location, and the people we were with.
|
||||
id<SCOGEatMealAction> action = (id<SCOGEatMealAction>)[FBGraphObject graphObject];
|
||||
|
||||
if (self.selectedPlace) {
|
||||
// Facebook SDK * pro-tip *
|
||||
// We don't use the action.place syntax here because, unfortunately, setPlace:
|
||||
// and a few other selectors may be flagged as reserved selectors by Apple's App Store
|
||||
// validation tools. While this doesn't necessarily block App Store approval, it
|
||||
// could slow down the approval process. Falling back to the setObject:forKey:
|
||||
// selector is a useful technique to avoid such naming conflicts.
|
||||
[action setObject:self.selectedPlace forKey:@"place"];
|
||||
}
|
||||
|
||||
if (self.selectedFriends.count > 0) {
|
||||
[action setObject:self.selectedFriends forKey:@"tags"];
|
||||
}
|
||||
|
||||
return action;
|
||||
}
|
||||
|
||||
// Creates the Open Graph Action.
|
||||
- (void)postOpenGraphAction {
|
||||
[self enableUserInteraction:NO];
|
||||
|
||||
FBRequestConnection *requestConnection = [[FBRequestConnection alloc] init];
|
||||
requestConnection.errorBehavior = FBRequestConnectionErrorBehaviorRetry
|
||||
| FBRequestConnectionErrorBehaviorReconnectSession;
|
||||
if (self.selectedPhoto) {
|
||||
self.selectedPhoto = [self normalizedImage:self.selectedPhoto];
|
||||
FBRequest *stagingRequest = [FBRequest requestForUploadStagingResourceWithImage:self.selectedPhoto];
|
||||
[requestConnection addRequest:stagingRequest
|
||||
completionHandler:^(FBRequestConnection *connection, id result, NSError *error) {
|
||||
if (error) {
|
||||
[self enableUserInteraction:YES];
|
||||
[self handlePostOpenGraphActionError:error];
|
||||
}
|
||||
}
|
||||
batchEntryName:@"stagedphoto"];
|
||||
}
|
||||
|
||||
// Create an Open Graph eat action with the meal, our location, and the people we were with.
|
||||
id<SCOGEatMealAction> action = [self actionFromMealInfo];
|
||||
|
||||
if (self.selectedPhoto) {
|
||||
action.image = @[ @{ @"url" : @"{result=stagedphoto:$.uri}", @"user_generated" : @"true" } ];
|
||||
}
|
||||
|
||||
// create the Open Graph meal object for the meal we ate.
|
||||
id<SCOGMeal> mealObject = [self mealObjectForMeal:self.selectedMeal];
|
||||
if (mealObject) {
|
||||
action.meal = mealObject;
|
||||
} else {
|
||||
// Facebook SDK * Object API *
|
||||
id object = [FBGraphObject openGraphObjectForPostWithType:@"fb_sample_scrumps:meal"
|
||||
title:self.selectedMeal
|
||||
image:@"https://fbcdn-photos-a.akamaihd.net/photos-ak-snc7/v85005/200/233936543368280/app_1_233936543368280_595563194.gif"
|
||||
url:nil
|
||||
description:[@"Delicious " stringByAppendingString:self.selectedMeal]];
|
||||
FBRequest *createObject = [FBRequest requestForPostOpenGraphObject:object];
|
||||
|
||||
// We'll add the object creaction to the batch, and set the action's meal accordingly.
|
||||
[requestConnection addRequest:createObject
|
||||
completionHandler:^(FBRequestConnection *connection, id result, NSError *error) {
|
||||
if (error) {
|
||||
[self enableUserInteraction:YES];
|
||||
[self handlePostOpenGraphActionError:error];
|
||||
}
|
||||
}
|
||||
batchEntryName:@"createobject"];
|
||||
|
||||
action[@"meal"] = @"{result=createobject:$.id}";
|
||||
}
|
||||
|
||||
// Create the request and post the action to the "me/fb_sample_scrumps:eat" path.
|
||||
FBRequest *actionRequest = [FBRequest requestForPostWithGraphPath:@"me/fb_sample_scrumps:eat"
|
||||
graphObject:action];
|
||||
[requestConnection addRequest:actionRequest
|
||||
completionHandler:^(FBRequestConnection *connection,
|
||||
id result,
|
||||
NSError *error) {
|
||||
|
||||
[self enableUserInteraction:YES];
|
||||
if (!error) {
|
||||
[[[UIAlertView alloc] initWithTitle:@"Result"
|
||||
message:[NSString stringWithFormat:@"Posted Open Graph action, id: %@",
|
||||
[result objectForKey:@"id"]]
|
||||
delegate:nil
|
||||
cancelButtonTitle:@"Thanks!"
|
||||
otherButtonTitles:nil]
|
||||
show];
|
||||
|
||||
// start over
|
||||
[self resetMealInfo];
|
||||
} else {
|
||||
[self handlePostOpenGraphActionError:error];
|
||||
}
|
||||
}];
|
||||
[requestConnection start];
|
||||
}
|
||||
|
||||
- (void)resetMealInfo {
|
||||
// start over
|
||||
self.selectedMeal = nil;
|
||||
self.selectedPlace = nil;
|
||||
self.selectedFriends = nil;
|
||||
self.selectedPhoto = nil;
|
||||
_retryCount = 0;
|
||||
[self updateSelections];
|
||||
}
|
||||
|
||||
- (void)handlePostOpenGraphActionError:(NSError *) error{
|
||||
// Facebook SDK * error handling *
|
||||
// Some Graph API errors are retriable. For this sample, we will have a simple
|
||||
// retry policy of one additional attempt. Please refer to
|
||||
// https://developers.facebook.com/docs/reference/api/errors/ for more information.
|
||||
_retryCount++;
|
||||
if (error.fberrorCategory == FBErrorCategoryThrottling) {
|
||||
// We also retry on a throttling error message. A more sophisticated app
|
||||
// should consider a back-off period.
|
||||
if (_retryCount < 2) {
|
||||
NSLog(@"Retrying open graph post");
|
||||
[self postOpenGraphAction];
|
||||
return;
|
||||
} else {
|
||||
NSLog(@"Retry count exceeded.");
|
||||
}
|
||||
}
|
||||
|
||||
// Facebook SDK * pro-tip *
|
||||
// Users can revoke post permissions on your app externally so it
|
||||
// can be worthwhile to request for permissions again at the point
|
||||
// that they are needed. This sample assumes a simple policy
|
||||
// of re-requesting permissions.
|
||||
if (error.fberrorCategory == FBErrorCategoryPermissions) {
|
||||
NSLog(@"Re-requesting permissions");
|
||||
[self requestPermissionAndPost];
|
||||
return;
|
||||
}
|
||||
|
||||
// Facebook SDK * error handling *
|
||||
[self presentAlertForError:error];
|
||||
}
|
||||
// Helper method to request publish permissions and post.
|
||||
- (void)requestPermissionAndPost {
|
||||
[FBSession.activeSession requestNewPublishPermissions:[NSArray arrayWithObject:@"publish_actions"]
|
||||
defaultAudience:FBSessionDefaultAudienceFriends
|
||||
completionHandler:^(FBSession *session, NSError *error) {
|
||||
if (!error && [FBSession.activeSession.permissions indexOfObject:@"publish_actions"] != NSNotFound) {
|
||||
// Now have the permission
|
||||
[self postOpenGraphAction];
|
||||
} else if (error){
|
||||
// Facebook SDK * error handling *
|
||||
// if the operation is not user cancelled
|
||||
if (error.fberrorCategory != FBErrorCategoryUserCancelled) {
|
||||
[self presentAlertForError:error];
|
||||
}
|
||||
}
|
||||
}];
|
||||
}
|
||||
|
||||
- (void) presentAlertForError:(NSError *)error {
|
||||
// Facebook SDK * error handling *
|
||||
// Error handling is an important part of providing a good user experience.
|
||||
// When fberrorShouldNotifyUser is YES, a fberrorUserMessage can be
|
||||
// presented as a user-ready message
|
||||
if (error.fberrorShouldNotifyUser) {
|
||||
// The SDK has a message for the user, surface it.
|
||||
[[[UIAlertView alloc] initWithTitle:@"Something Went Wrong"
|
||||
message:error.fberrorUserMessage
|
||||
delegate:nil
|
||||
cancelButtonTitle:@"OK"
|
||||
otherButtonTitles:nil] show];
|
||||
} else {
|
||||
NSLog(@"unexpected error:%@", error);
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - UI Behavior
|
||||
|
||||
-(void)settingsButtonWasPressed:(id)sender {
|
||||
[self presentLoginSettings];
|
||||
}
|
||||
|
||||
-(void)presentLoginSettings {
|
||||
if (self.settingsViewController == nil) {
|
||||
self.settingsViewController = [[FBUserSettingsViewController alloc] init];
|
||||
#ifdef __IPHONE_7_0
|
||||
if ([self.settingsViewController respondsToSelector:@selector(setEdgesForExtendedLayout:)]) {
|
||||
self.settingsViewController.edgesForExtendedLayout &= ~UIRectEdgeTop;
|
||||
}
|
||||
#endif
|
||||
self.settingsViewController.delegate = self;
|
||||
}
|
||||
|
||||
[self.navigationController pushViewController:self.settingsViewController animated:YES];
|
||||
}
|
||||
|
||||
// Handles the user clicking the Announce button by creating an Open Graph Action
|
||||
- (IBAction)announce:(id)sender {
|
||||
if (FBSession.activeSession.isOpen) {
|
||||
// Facebook SDK * pro-tip *
|
||||
// Ask for publish permissions only at the time they are needed.
|
||||
if ([FBSession.activeSession.permissions indexOfObject:@"publish_actions"] == NSNotFound) {
|
||||
[self requestPermissionAndPost];
|
||||
} else {
|
||||
[self postOpenGraphAction];
|
||||
}
|
||||
} else {
|
||||
// Facebook SDK * pro-tip *
|
||||
// Support sharing even if the user isn't logged in with Facebook, by using the share dialog
|
||||
[self presentShareDialogForMealInfo];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)presentShareDialogForMealInfo {
|
||||
id image = @"https://fbcdn-photos-a.akamaihd.net/photos-ak-snc7/v85005/200/233936543368280/app_1_233936543368280_595563194.gif";
|
||||
// Create an Open Graph eat action with the meal, our location, and the people we were with.
|
||||
id<SCOGEatMealAction> action = [self actionFromMealInfo];
|
||||
|
||||
if (self.selectedPhoto) {
|
||||
self.selectedPhoto = [self normalizedImage:self.selectedPhoto];
|
||||
action.image = self.selectedPhoto;
|
||||
image = @[@{@"url":self.selectedPhoto, @"user_generated":@"true"}];
|
||||
}
|
||||
|
||||
id object = [FBGraphObject openGraphObjectForPostWithType:@"fb_sample_scrumps:meal"
|
||||
title:self.selectedMeal
|
||||
image:image
|
||||
url:nil
|
||||
description:[@"Delicious " stringByAppendingString:self.selectedMeal]];
|
||||
action.meal = object;
|
||||
|
||||
BOOL presentable = nil != [FBDialogs presentShareDialogWithOpenGraphAction:action
|
||||
actionType:@"fb_sample_scrumps:eat"
|
||||
previewPropertyName:@"meal"
|
||||
handler:^(FBAppCall *call, NSDictionary *results, NSError *error) {
|
||||
if (!error) {
|
||||
[self resetMealInfo];
|
||||
} else {
|
||||
NSLog(@"%@", error);
|
||||
}
|
||||
}];
|
||||
if (!presentable) { // this means that the Facebook app is not installed or up to date
|
||||
// if the share dialog is not available, lets encourage a login so we can share directly
|
||||
[self presentLoginSettings];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)centerAndShowActivityIndicator {
|
||||
CGRect frame = self.view.frame;
|
||||
CGPoint center = CGPointMake(CGRectGetMidX(frame), CGRectGetMidY(frame));
|
||||
self.activityIndicator.center = center;
|
||||
[self.activityIndicator startAnimating];
|
||||
}
|
||||
|
||||
// Displays the user's name and profile picture so they are aware of the Facebook
|
||||
// identity they are logged in as.
|
||||
- (void)populateUserDetails {
|
||||
if (FBSession.activeSession.isOpen) {
|
||||
[[FBRequest requestForMe] startWithCompletionHandler:
|
||||
^(FBRequestConnection *connection, NSDictionary<FBGraphUser> *user, NSError *error) {
|
||||
if (!error) {
|
||||
self.userNameLabel.text = user.name;
|
||||
self.userProfileImage.profileID = [user objectForKey:@"id"];
|
||||
}
|
||||
}];
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark UIImagePickerControllerDelegate methods
|
||||
|
||||
- (void)imagePickerController:(UIImagePickerController *)picker
|
||||
didFinishPickingImage:(UIImage *)image
|
||||
editingInfo:(NSDictionary *)editingInfo {
|
||||
|
||||
if (!self.photoViewController) {
|
||||
__block SCViewController *myself = self;
|
||||
self.photoViewController = [[SCPhotoViewController alloc]initWithNibName:@"SCPhotoViewController" bundle:nil image:image];
|
||||
self.photoViewController.confirmCallback = ^(id sender, bool confirm) {
|
||||
if(confirm) {
|
||||
myself.selectedPhoto = image;
|
||||
}
|
||||
[myself updateSelections];
|
||||
};
|
||||
}
|
||||
[self.navigationController pushViewController:self.photoViewController animated:true];
|
||||
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
|
||||
[self.popover dismissPopoverAnimated:YES];
|
||||
} else {
|
||||
[self dismissModalViewControllerAnimated:YES];
|
||||
}
|
||||
self.photoViewController = nil;
|
||||
}
|
||||
|
||||
#pragma mark - UIActionSheetDelegate methods
|
||||
|
||||
- (void)actionSheet:(UIActionSheet *)actionSheet didDismissWithButtonIndex:(NSInteger)buttonIndex {
|
||||
|
||||
// If user presses cancel, do nothing
|
||||
if (buttonIndex == actionSheet.cancelButtonIndex)
|
||||
return;
|
||||
|
||||
// One method handles the delegate action for two action sheets
|
||||
if (actionSheet == self.mealPickerActionSheet) {
|
||||
if (buttonIndex == 0) {
|
||||
// They chose manual entry so prompt the user for an entry.
|
||||
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:nil message:@"What are you eating?" delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:@"OK", nil];
|
||||
alert.alertViewStyle = UIAlertViewStylePlainTextInput;
|
||||
[alert textFieldAtIndex:0].autocapitalizationType = UITextAutocapitalizationTypeSentences;
|
||||
[alert show];
|
||||
} else {
|
||||
self.selectedMeal = [self.mealTypes objectAtIndex:buttonIndex];
|
||||
[self updateSelections];
|
||||
}
|
||||
} else { // self.imagePickerActionSheet
|
||||
NSAssert(actionSheet == self.imagePickerActionSheet, @"Delegate method's else-case should be for image picker");
|
||||
|
||||
if (!self.imagePicker) {
|
||||
self.imagePicker = [[UIImagePickerController alloc] init];
|
||||
self.imagePicker.delegate = self;
|
||||
}
|
||||
|
||||
// Set the source type of the imagePicker to the users selection
|
||||
if (buttonIndex == 0) {
|
||||
// If its the simulator, camera is no good
|
||||
if(TARGET_IPHONE_SIMULATOR){
|
||||
[[[UIAlertView alloc] initWithTitle:@"Camera not supported in simulator."
|
||||
message:@"(>'_')>"
|
||||
delegate:nil
|
||||
cancelButtonTitle:@"Ok"
|
||||
otherButtonTitles:nil] show];
|
||||
return;
|
||||
}
|
||||
self.imagePicker.sourceType = UIImagePickerControllerSourceTypeCamera;
|
||||
} else if (buttonIndex == 1) {
|
||||
self.imagePicker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
|
||||
}
|
||||
|
||||
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
|
||||
// Can't use presentModalViewController for image picker on iPad
|
||||
if (!self.popover) {
|
||||
self.popover = [[UIPopoverController alloc] initWithContentViewController:self.imagePicker];
|
||||
}
|
||||
[self.popover presentPopoverFromRect:self.popoverFromRect
|
||||
inView:self.view
|
||||
permittedArrowDirections:UIPopoverArrowDirectionAny
|
||||
animated:YES];
|
||||
} else {
|
||||
[self presentModalViewController:self.imagePicker animated:YES];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - Overrides
|
||||
|
||||
- (void)dealloc {
|
||||
_locationManager.delegate = nil;
|
||||
_mealPickerActionSheet.delegate = nil;
|
||||
_settingsViewController.delegate = nil;
|
||||
_imagePicker.delegate = nil;
|
||||
_imagePickerActionSheet.delegate = nil;
|
||||
}
|
||||
|
||||
- (void)viewDidLoad {
|
||||
[super viewDidLoad];
|
||||
|
||||
self.title = @"Scrumptious";
|
||||
|
||||
// Get the CLLocationManager going.
|
||||
self.locationManager = [[CLLocationManager alloc] init];
|
||||
self.locationManager.delegate = self;
|
||||
self.locationManager.desiredAccuracy = kCLLocationAccuracyHundredMeters;
|
||||
// We don't want to be notified of small changes in location, preferring to use our
|
||||
// last cached results, if any.
|
||||
self.locationManager.distanceFilter = 50;
|
||||
|
||||
FBCacheDescriptor *cacheDescriptor = [FBFriendPickerViewController cacheDescriptor];
|
||||
[cacheDescriptor prefetchAndCacheForSession:FBSession.activeSession];
|
||||
|
||||
// This avoids a gray background in the table view on iPad.
|
||||
if ([self.menuTableView respondsToSelector:@selector(backgroundView)]) {
|
||||
self.menuTableView.backgroundView = nil;
|
||||
}
|
||||
|
||||
self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc]
|
||||
initWithTitle:@"Settings"
|
||||
style:UIBarButtonItemStyleBordered
|
||||
target:self
|
||||
action:@selector(settingsButtonWasPressed:)];
|
||||
|
||||
self.activityIndicator = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray];
|
||||
self.activityIndicator.hidesWhenStopped = YES;
|
||||
[self.view addSubview:self.activityIndicator];
|
||||
}
|
||||
|
||||
-(void)viewWillAppear:(BOOL)animated {
|
||||
[super viewWillAppear:animated];
|
||||
|
||||
if (FBSession.activeSession.isOpen) {
|
||||
[self populateUserDetails];
|
||||
self.userProfileImage.hidden = NO;
|
||||
} else {
|
||||
self.userProfileImage.hidden = YES;
|
||||
}
|
||||
}
|
||||
|
||||
- (void) viewDidAppear:(BOOL)animated {
|
||||
if (FBSession.activeSession.isOpen) {
|
||||
[self.locationManager startUpdatingLocation];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)viewDidUnload {
|
||||
[super viewDidUnload];
|
||||
|
||||
[[NSNotificationCenter defaultCenter] removeObserver:self];
|
||||
|
||||
// Release any retained subviews of the main view.
|
||||
self.mealPickerActionSheet = nil;
|
||||
}
|
||||
|
||||
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
|
||||
return (interfaceOrientation != UIInterfaceOrientationPortraitUpsideDown);
|
||||
}
|
||||
|
||||
#pragma mark - UIAlertViewDelegate
|
||||
|
||||
- (void)alertView:(UIAlertView *)alertView didDismissWithButtonIndex:(NSInteger)buttonIndex {
|
||||
if (!alertView.cancelButtonIndex == buttonIndex) {
|
||||
self.selectedMeal = [alertView textFieldAtIndex:0].text;
|
||||
[self updateSelections];
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - FBUserSettingsDelegate methods
|
||||
|
||||
- (void)loginViewControllerDidLogUserOut:(id)sender {
|
||||
// Facebook SDK * login flow *
|
||||
// There are many ways to implement the Facebook login flow.
|
||||
// In this sample, the FBLoginView delegate (SCLoginViewController)
|
||||
// will already handle logging out so this method is a no-op.
|
||||
}
|
||||
|
||||
- (void)loginViewController:(id)sender receivedError:(NSError *)error{
|
||||
// Facebook SDK * login flow *
|
||||
// There are many ways to implement the Facebook login flow.
|
||||
// In this sample, the FBUserSettingsViewController is only presented
|
||||
// as a log out option after the user has been authenticated, so
|
||||
// no real errors should occur. If the FBUserSettingsViewController
|
||||
// had been the entry point to the app, then this error handler should
|
||||
// be as rigorous as the FBLoginView delegate (SCLoginViewController)
|
||||
// in order to handle login errors.
|
||||
if (error) {
|
||||
NSLog(@"Unexpected error sent to the FBUserSettingsViewController delegate: %@", error);
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - UITableViewDataSource methods and related helpers
|
||||
|
||||
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
|
||||
return 4;
|
||||
}
|
||||
|
||||
- (UITableViewCell*)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
|
||||
{
|
||||
static NSString *CellIdentifier = @"Cell";
|
||||
|
||||
UITableViewCell *cell = (UITableViewCell*)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
|
||||
if (cell == nil) {
|
||||
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier];
|
||||
cell.accessoryType = UITableViewCellAccessoryNone;
|
||||
cell.selectionStyle = UITableViewCellSelectionStyleNone;
|
||||
|
||||
cell.textLabel.font = [UIFont systemFontOfSize:16];
|
||||
cell.textLabel.backgroundColor = [UIColor colorWithWhite:0 alpha:0];
|
||||
cell.textLabel.lineBreakMode = UILineBreakModeTailTruncation;
|
||||
cell.textLabel.clipsToBounds = YES;
|
||||
|
||||
cell.detailTextLabel.font = [UIFont systemFontOfSize:12];
|
||||
cell.detailTextLabel.backgroundColor = [UIColor colorWithWhite:0 alpha:0];
|
||||
cell.detailTextLabel.textColor = [UIColor colorWithRed:0.4 green:0.6 blue:0.8 alpha:1];
|
||||
cell.detailTextLabel.lineBreakMode = UILineBreakModeTailTruncation;
|
||||
cell.detailTextLabel.clipsToBounds = YES;
|
||||
}
|
||||
|
||||
switch (indexPath.row) {
|
||||
case 0:
|
||||
cell.textLabel.text = @"What are you eating?";
|
||||
cell.detailTextLabel.text = @"Select one";
|
||||
cell.imageView.image = [UIImage imageNamed:@"action-eating.png"];
|
||||
break;
|
||||
|
||||
case 1:
|
||||
cell.textLabel.text = @"Where are you?";
|
||||
cell.detailTextLabel.text = @"Select one";
|
||||
cell.imageView.image = [UIImage imageNamed:@"action-location.png"];
|
||||
break;
|
||||
|
||||
case 2:
|
||||
cell.textLabel.text = @"With whom?";
|
||||
cell.detailTextLabel.text = @"Select friends";
|
||||
cell.imageView.image = [UIImage imageNamed:@"action-people.png"];
|
||||
break;
|
||||
|
||||
case 3:
|
||||
cell.textLabel.text = @"Got a picture?";
|
||||
cell.detailTextLabel.text = @"Take one";
|
||||
cell.imageView.image = [UIImage imageNamed:@"action-photo.png"];
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return cell;
|
||||
}
|
||||
|
||||
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
|
||||
return 1;
|
||||
}
|
||||
|
||||
- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath {
|
||||
return NO;
|
||||
}
|
||||
|
||||
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
|
||||
switch (indexPath.row) {
|
||||
case 0: {
|
||||
// if we don't yet have an array of meal types, create one now
|
||||
if (!self.mealTypes) {
|
||||
self.mealTypes = [NSArray arrayWithObjects:
|
||||
@"< Write Your Own >",
|
||||
@"Cheeseburger",
|
||||
@"Pizza",
|
||||
@"Hotdog",
|
||||
@"Italian",
|
||||
@"French",
|
||||
@"Chinese",
|
||||
@"Thai",
|
||||
@"Indian",
|
||||
nil];
|
||||
}
|
||||
self.mealPickerActionSheet = [[UIActionSheet alloc] initWithTitle:@"Select a meal"
|
||||
delegate:self
|
||||
cancelButtonTitle:nil
|
||||
destructiveButtonTitle:nil
|
||||
otherButtonTitles:nil];
|
||||
|
||||
for( NSString *meal in self.mealTypes) {
|
||||
[self.mealPickerActionSheet addButtonWithTitle:meal];
|
||||
}
|
||||
|
||||
self.mealPickerActionSheet.cancelButtonIndex = [self.mealPickerActionSheet addButtonWithTitle:@"Cancel"];
|
||||
[self.mealPickerActionSheet showFromToolbar:self.navigationController.toolbar];
|
||||
return;
|
||||
}
|
||||
|
||||
case 1: {
|
||||
if (FBSession.activeSession.isOpen) {
|
||||
FBPlacePickerViewController *placePicker = [[FBPlacePickerViewController alloc] init];
|
||||
|
||||
placePicker.title = @"Select a restaurant";
|
||||
|
||||
// SIMULATOR BUG:
|
||||
// See http://stackoverflow.com/questions/7003155/error-server-did-not-accept-client-registration-68
|
||||
// at times the simulator fails to fetch a location; when that happens rather than fetch a
|
||||
// a meal near 0,0 -- let's see if we can find something good in Paris
|
||||
if (self.placeCacheDescriptor == nil) {
|
||||
[self setPlaceCacheDescriptorForCoordinates:CLLocationCoordinate2DMake(48.857875, 2.294635)];
|
||||
}
|
||||
|
||||
[placePicker configureUsingCachedDescriptor:self.placeCacheDescriptor];
|
||||
[placePicker loadData];
|
||||
[placePicker presentModallyFromViewController:self
|
||||
animated:YES
|
||||
handler:^(FBViewController *sender, BOOL donePressed) {
|
||||
if (donePressed) {
|
||||
self.selectedPlace = placePicker.selection;
|
||||
[self updateSelections];
|
||||
}
|
||||
}];
|
||||
} else {
|
||||
// if not logged in, give the user the option to log in
|
||||
[self presentLoginSettings];
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
case 2: {
|
||||
if (FBSession.activeSession.isOpen) {
|
||||
FBFriendPickerViewController *friendPicker = [[FBFriendPickerViewController alloc] init];
|
||||
|
||||
// Set up the friend picker to sort and display names the same way as the
|
||||
// iOS Address Book does.
|
||||
|
||||
// Need to call ABAddressBookCreate in order for the next two calls to do anything.
|
||||
ABAddressBookRef addressBook = ABAddressBookCreate();
|
||||
ABPersonSortOrdering sortOrdering = ABPersonGetSortOrdering();
|
||||
ABPersonCompositeNameFormat nameFormat = ABPersonGetCompositeNameFormat();
|
||||
|
||||
friendPicker.sortOrdering = (sortOrdering == kABPersonSortByFirstName) ? FBFriendSortByFirstName : FBFriendSortByLastName;
|
||||
friendPicker.displayOrdering = (nameFormat == kABPersonCompositeNameFormatFirstNameFirst) ? FBFriendDisplayByFirstName : FBFriendDisplayByLastName;
|
||||
|
||||
[friendPicker loadData];
|
||||
[friendPicker presentModallyFromViewController:self
|
||||
animated:YES
|
||||
handler:^(FBViewController *sender, BOOL donePressed) {
|
||||
if (donePressed) {
|
||||
self.selectedFriends = friendPicker.selection;
|
||||
[self updateSelections];
|
||||
}
|
||||
}];
|
||||
CFRelease(addressBook);
|
||||
} else {
|
||||
// if not logged in, give the user the option to log in
|
||||
[self presentLoginSettings];
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
case 3:
|
||||
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
|
||||
self.popoverFromRect = [tableView rectForRowAtIndexPath:indexPath];
|
||||
}
|
||||
if(!self.imagePickerActionSheet) {
|
||||
self.imagePickerActionSheet = [[UIActionSheet alloc] initWithTitle:@""
|
||||
delegate:self
|
||||
cancelButtonTitle:@"Cancel"
|
||||
destructiveButtonTitle:nil
|
||||
otherButtonTitles:@"Take Photo", @"Choose Existing", nil];
|
||||
}
|
||||
|
||||
[self.imagePickerActionSheet showInView:self.view];
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
- (void)updateCellIndex:(int)index withSubtitle:(NSString *)subtitle {
|
||||
UITableViewCell *cell = (UITableViewCell *)[self.menuTableView cellForRowAtIndexPath:
|
||||
[NSIndexPath indexPathForRow:index inSection:0]];
|
||||
cell.detailTextLabel.text = subtitle;
|
||||
}
|
||||
|
||||
- (void)updateSelections {
|
||||
[self updateCellIndex:0 withSubtitle:(self.selectedMeal ?
|
||||
self.selectedMeal :
|
||||
@"Select one")];
|
||||
[self updateCellIndex:1 withSubtitle:(self.selectedPlace ?
|
||||
self.selectedPlace.name :
|
||||
@"Select one")];
|
||||
|
||||
NSString *friendsSubtitle = @"Select friends";
|
||||
int friendCount = self.selectedFriends.count;
|
||||
if (friendCount > 2) {
|
||||
// Just to mix things up, don't always show the first friend.
|
||||
id<FBGraphUser> randomFriend = [self.selectedFriends objectAtIndex:arc4random() % friendCount];
|
||||
friendsSubtitle = [NSString stringWithFormat:@"%@ and %d others",
|
||||
randomFriend.name,
|
||||
friendCount - 1];
|
||||
} else if (friendCount == 2) {
|
||||
id<FBGraphUser> friend1 = [self.selectedFriends objectAtIndex:0];
|
||||
id<FBGraphUser> friend2 = [self.selectedFriends objectAtIndex:1];
|
||||
friendsSubtitle = [NSString stringWithFormat:@"%@ and %@",
|
||||
friend1.name,
|
||||
friend2.name];
|
||||
} else if (friendCount == 1) {
|
||||
id<FBGraphUser> friend = [self.selectedFriends objectAtIndex:0];
|
||||
friendsSubtitle = friend.name;
|
||||
}
|
||||
[self updateCellIndex:2 withSubtitle:friendsSubtitle];
|
||||
|
||||
[self updateCellIndex:3 withSubtitle:(self.selectedPhoto ? @"Ready" : @"Take one")];
|
||||
|
||||
self.announceButton.enabled = (self.selectedMeal != nil);
|
||||
}
|
||||
|
||||
#pragma mark - CLLocationManagerDelegate methods and related
|
||||
|
||||
- (void)locationManager:(CLLocationManager *)manager
|
||||
didUpdateToLocation:(CLLocation *)newLocation
|
||||
fromLocation:(CLLocation *)oldLocation {
|
||||
if (!oldLocation ||
|
||||
(oldLocation.coordinate.latitude != newLocation.coordinate.latitude &&
|
||||
oldLocation.coordinate.longitude != newLocation.coordinate.longitude &&
|
||||
newLocation.horizontalAccuracy <= 100.0)) {
|
||||
// Fetch data at this new location, and remember the cache descriptor.
|
||||
[self setPlaceCacheDescriptorForCoordinates:newLocation.coordinate];
|
||||
[self.placeCacheDescriptor prefetchAndCacheForSession:FBSession.activeSession];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)locationManager:(CLLocationManager *)manager
|
||||
didFailWithError:(NSError *)error {
|
||||
NSLog(@"%@", error);
|
||||
}
|
||||
|
||||
- (void)setPlaceCacheDescriptorForCoordinates:(CLLocationCoordinate2D)coordinates {
|
||||
self.placeCacheDescriptor =
|
||||
[FBPlacePickerViewController cacheDescriptorWithLocationCoordinate:coordinates
|
||||
radiusInMeters:1000
|
||||
searchText:@"restaurant"
|
||||
resultsLimit:50
|
||||
fieldsForRequest:nil];
|
||||
}
|
||||
|
||||
#pragma mark -
|
||||
|
||||
- (UIImage*) normalizedImage:(UIImage*)image {
|
||||
CGImageRef imgRef = image.CGImage;
|
||||
CGFloat width = CGImageGetWidth(imgRef);
|
||||
CGFloat height = CGImageGetHeight(imgRef);
|
||||
CGAffineTransform transform = CGAffineTransformIdentity;
|
||||
CGRect bounds = CGRectMake(0, 0, width, height);
|
||||
CGSize imageSize = bounds.size;
|
||||
CGFloat boundHeight;
|
||||
UIImageOrientation orient = image.imageOrientation;
|
||||
|
||||
switch (orient) {
|
||||
case UIImageOrientationUp: //EXIF = 1
|
||||
transform = CGAffineTransformIdentity;
|
||||
break;
|
||||
|
||||
case UIImageOrientationDown: //EXIF = 3
|
||||
transform = CGAffineTransformMakeTranslation(imageSize.width, imageSize.height);
|
||||
transform = CGAffineTransformRotate(transform, M_PI);
|
||||
break;
|
||||
|
||||
case UIImageOrientationLeft: //EXIF = 6
|
||||
boundHeight = bounds.size.height;
|
||||
bounds.size.height = bounds.size.width;
|
||||
bounds.size.width = boundHeight;
|
||||
transform = CGAffineTransformMakeTranslation(imageSize.height, imageSize.width);
|
||||
transform = CGAffineTransformScale(transform, -1.0, 1.0);
|
||||
transform = CGAffineTransformRotate(transform, 3.0 * M_PI / 2.0);
|
||||
break;
|
||||
|
||||
case UIImageOrientationRight: //EXIF = 8
|
||||
boundHeight = bounds.size.height;
|
||||
bounds.size.height = bounds.size.width;
|
||||
bounds.size.width = boundHeight;
|
||||
transform = CGAffineTransformMakeTranslation(0.0, imageSize.width);
|
||||
transform = CGAffineTransformRotate(transform, 3.0 * M_PI / 2.0);
|
||||
break;
|
||||
|
||||
default:
|
||||
// image is not auto-rotated by the photo picker, so whatever the user
|
||||
// sees is what they expect to get. No modification necessary
|
||||
transform = CGAffineTransformIdentity;
|
||||
break;
|
||||
}
|
||||
|
||||
UIGraphicsBeginImageContext(bounds.size);
|
||||
CGContextRef context = UIGraphicsGetCurrentContext();
|
||||
|
||||
if ((image.imageOrientation == UIImageOrientationDown) ||
|
||||
(image.imageOrientation == UIImageOrientationRight) ||
|
||||
(image.imageOrientation == UIImageOrientationUp)) {
|
||||
// flip the coordinate space upside down
|
||||
CGContextScaleCTM(context, 1, -1);
|
||||
CGContextTranslateCTM(context, 0, -height);
|
||||
}
|
||||
|
||||
CGContextConcatCTM(context, transform);
|
||||
CGContextDrawImage(UIGraphicsGetCurrentContext(), CGRectMake(0, 0, width, height), imgRef);
|
||||
UIImage *imageCopy = UIGraphicsGetImageFromCurrentImageContext();
|
||||
UIGraphicsEndImageContext();
|
||||
|
||||
return imageCopy;
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,2 @@
|
||||
/* Localized versions of Info.plist keys */
|
||||
|
||||
@@ -0,0 +1,367 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<archive type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="8.00">
|
||||
<data>
|
||||
<int key="IBDocument.SystemTarget">1296</int>
|
||||
<string key="IBDocument.SystemVersion">11D50d</string>
|
||||
<string key="IBDocument.InterfaceBuilderVersion">2182</string>
|
||||
<string key="IBDocument.AppKitVersion">1138.32</string>
|
||||
<string key="IBDocument.HIToolboxVersion">568.00</string>
|
||||
<object class="NSMutableDictionary" key="IBDocument.PluginVersions">
|
||||
<string key="NS.key.0">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
||||
<string key="NS.object.0">1181</string>
|
||||
</object>
|
||||
<array key="IBDocument.IntegratedClassDependencies">
|
||||
<string>IBUITableView</string>
|
||||
<string>IBUIButton</string>
|
||||
<string>IBUIView</string>
|
||||
<string>IBUILabel</string>
|
||||
<string>IBProxyObject</string>
|
||||
</array>
|
||||
<array key="IBDocument.PluginDependencies">
|
||||
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
||||
</array>
|
||||
<object class="NSMutableDictionary" key="IBDocument.Metadata">
|
||||
<string key="NS.key.0">PluginDependencyRecalculationVersion</string>
|
||||
<integer value="1" key="NS.object.0"/>
|
||||
</object>
|
||||
<array class="NSMutableArray" key="IBDocument.RootObjects" id="1000">
|
||||
<object class="IBProxyObject" id="372490531">
|
||||
<string key="IBProxiedObjectIdentifier">IBFilesOwner</string>
|
||||
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
|
||||
</object>
|
||||
<object class="IBProxyObject" id="843779117">
|
||||
<string key="IBProxiedObjectIdentifier">IBFirstResponder</string>
|
||||
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
|
||||
</object>
|
||||
<object class="IBUIView" id="774585933">
|
||||
<reference key="NSNextResponder"/>
|
||||
<int key="NSvFlags">274</int>
|
||||
<array class="NSMutableArray" key="NSSubviews">
|
||||
<object class="IBUILabel" id="422181324">
|
||||
<reference key="NSNextResponder" ref="774585933"/>
|
||||
<int key="NSvFlags">288</int>
|
||||
<string key="NSFrame">{{104, 17}, {210, 21}}</string>
|
||||
<reference key="NSSuperview" ref="774585933"/>
|
||||
<reference key="NSWindow"/>
|
||||
<reference key="NSNextKeyView" ref="759518333"/>
|
||||
<string key="NSReuseIdentifierKey">_NS:9</string>
|
||||
<bool key="IBUIOpaque">NO</bool>
|
||||
<bool key="IBUIClipsSubviews">YES</bool>
|
||||
<int key="IBUIContentMode">7</int>
|
||||
<bool key="IBUIUserInteractionEnabled">NO</bool>
|
||||
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
|
||||
<string key="IBUIText"/>
|
||||
<object class="NSColor" key="IBUITextColor">
|
||||
<int key="NSColorSpace">1</int>
|
||||
<bytes key="NSRGB">MCAwIDAAA</bytes>
|
||||
</object>
|
||||
<nil key="IBUIHighlightedColor"/>
|
||||
<int key="IBUIBaselineAdjustment">0</int>
|
||||
<float key="IBUIMinimumFontSize">10</float>
|
||||
<object class="IBUIFontDescription" key="IBUIFontDescription">
|
||||
<int key="type">1</int>
|
||||
<double key="pointSize">17</double>
|
||||
</object>
|
||||
<object class="NSFont" key="IBUIFont">
|
||||
<string key="NSName">Helvetica</string>
|
||||
<double key="NSSize">17</double>
|
||||
<int key="NSfFlags">16</int>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBUITableView" id="759518333">
|
||||
<reference key="NSNextResponder" ref="774585933"/>
|
||||
<int key="NSvFlags">306</int>
|
||||
<string key="NSFrame">{{0, 118}, {320, 342}}</string>
|
||||
<reference key="NSSuperview" ref="774585933"/>
|
||||
<reference key="NSWindow"/>
|
||||
<reference key="NSNextKeyView" ref="522544887"/>
|
||||
<string key="NSReuseIdentifierKey">_NS:9</string>
|
||||
<object class="NSColor" key="IBUIBackgroundColor">
|
||||
<int key="NSColorSpace">1</int>
|
||||
<bytes key="NSRGB">MSAxIDEAA</bytes>
|
||||
</object>
|
||||
<bool key="IBUIClipsSubviews">YES</bool>
|
||||
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
|
||||
<bool key="IBUIAlwaysBounceVertical">YES</bool>
|
||||
<bool key="IBUIScrollEnabled">NO</bool>
|
||||
<int key="IBUIStyle">1</int>
|
||||
<int key="IBUISeparatorStyle">2</int>
|
||||
<int key="IBUISectionIndexMinimumDisplayRowCount">0</int>
|
||||
<float key="IBUIRowHeight">44</float>
|
||||
<float key="IBUISectionHeaderHeight">10</float>
|
||||
<float key="IBUISectionFooterHeight">10</float>
|
||||
</object>
|
||||
<object class="IBUIButton" id="522544887">
|
||||
<reference key="NSNextResponder" ref="774585933"/>
|
||||
<int key="NSvFlags">293</int>
|
||||
<string key="NSFrame">{{104, 348}, {106, 37}}</string>
|
||||
<reference key="NSSuperview" ref="774585933"/>
|
||||
<reference key="NSWindow"/>
|
||||
<string key="NSReuseIdentifierKey">_NS:9</string>
|
||||
<bool key="IBUIOpaque">NO</bool>
|
||||
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
|
||||
<bool key="IBUIEnabled">NO</bool>
|
||||
<int key="IBUIContentHorizontalAlignment">0</int>
|
||||
<int key="IBUIContentVerticalAlignment">0</int>
|
||||
<int key="IBUIButtonType">1</int>
|
||||
<string key="IBUINormalTitle">Announce</string>
|
||||
<object class="NSColor" key="IBUIHighlightedTitleColor" id="1044544176">
|
||||
<int key="NSColorSpace">3</int>
|
||||
<bytes key="NSWhite">MQA</bytes>
|
||||
</object>
|
||||
<object class="NSColor" key="IBUIDisabledTitleColor">
|
||||
<int key="NSColorSpace">1</int>
|
||||
<bytes key="NSRGB">MC44ODQ3NjU2MjUgMC44ODQ3NjU2MjUgMC44ODQ3NjU2MjUAA</bytes>
|
||||
</object>
|
||||
<object class="NSColor" key="IBUINormalTitleColor">
|
||||
<int key="NSColorSpace">1</int>
|
||||
<bytes key="NSRGB">MC4xOTYwNzg0MzQ2IDAuMzA5ODAzOTMyOSAwLjUyMTU2ODY1NgA</bytes>
|
||||
</object>
|
||||
<object class="NSColor" key="IBUINormalTitleShadowColor">
|
||||
<int key="NSColorSpace">3</int>
|
||||
<bytes key="NSWhite">MC41AA</bytes>
|
||||
</object>
|
||||
<object class="IBUIFontDescription" key="IBUIFontDescription">
|
||||
<int key="type">2</int>
|
||||
<double key="pointSize">15</double>
|
||||
</object>
|
||||
<object class="NSFont" key="IBUIFont">
|
||||
<string key="NSName">Helvetica-Bold</string>
|
||||
<double key="NSSize">15</double>
|
||||
<int key="NSfFlags">16</int>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBUIView" id="180598074">
|
||||
<reference key="NSNextResponder" ref="774585933"/>
|
||||
<int key="NSvFlags">292</int>
|
||||
<string key="NSFrame">{{20, 17}, {75, 75}}</string>
|
||||
<reference key="NSSuperview" ref="774585933"/>
|
||||
<reference key="NSWindow"/>
|
||||
<reference key="NSNextKeyView" ref="422181324"/>
|
||||
<string key="NSReuseIdentifierKey">_NS:9</string>
|
||||
<object class="NSColor" key="IBUIBackgroundColor">
|
||||
<int key="NSColorSpace">3</int>
|
||||
<bytes key="NSWhite">MQA</bytes>
|
||||
<object class="NSColorSpace" key="NSCustomColorSpace">
|
||||
<int key="NSID">2</int>
|
||||
</object>
|
||||
</object>
|
||||
<int key="IBUIContentMode">4</int>
|
||||
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
|
||||
</object>
|
||||
</array>
|
||||
<string key="NSFrame">{{0, 20}, {320, 460}}</string>
|
||||
<reference key="NSSuperview"/>
|
||||
<reference key="NSWindow"/>
|
||||
<reference key="NSNextKeyView" ref="180598074"/>
|
||||
<reference key="IBUIBackgroundColor" ref="1044544176"/>
|
||||
<bool key="IBUIClearsContextBeforeDrawing">NO</bool>
|
||||
<object class="IBUISimulatedStatusBarMetrics" key="IBUISimulatedStatusBarMetrics"/>
|
||||
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
|
||||
</object>
|
||||
</array>
|
||||
<object class="IBObjectContainer" key="IBDocument.Objects">
|
||||
<array class="NSMutableArray" key="connectionRecords">
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBCocoaTouchOutletConnection" key="connection">
|
||||
<string key="label">view</string>
|
||||
<reference key="source" ref="372490531"/>
|
||||
<reference key="destination" ref="774585933"/>
|
||||
</object>
|
||||
<int key="connectionID">7</int>
|
||||
</object>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBCocoaTouchOutletConnection" key="connection">
|
||||
<string key="label">userNameLabel</string>
|
||||
<reference key="source" ref="372490531"/>
|
||||
<reference key="destination" ref="422181324"/>
|
||||
</object>
|
||||
<int key="connectionID">21</int>
|
||||
</object>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBCocoaTouchOutletConnection" key="connection">
|
||||
<string key="label">announceButton</string>
|
||||
<reference key="source" ref="372490531"/>
|
||||
<reference key="destination" ref="522544887"/>
|
||||
</object>
|
||||
<int key="connectionID">26</int>
|
||||
</object>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBCocoaTouchOutletConnection" key="connection">
|
||||
<string key="label">userProfileImage</string>
|
||||
<reference key="source" ref="372490531"/>
|
||||
<reference key="destination" ref="180598074"/>
|
||||
</object>
|
||||
<int key="connectionID">29</int>
|
||||
</object>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBCocoaTouchOutletConnection" key="connection">
|
||||
<string key="label">menuTableView</string>
|
||||
<reference key="source" ref="372490531"/>
|
||||
<reference key="destination" ref="759518333"/>
|
||||
</object>
|
||||
<int key="connectionID">30</int>
|
||||
</object>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBCocoaTouchOutletConnection" key="connection">
|
||||
<string key="label">dataSource</string>
|
||||
<reference key="source" ref="759518333"/>
|
||||
<reference key="destination" ref="372490531"/>
|
||||
</object>
|
||||
<int key="connectionID">20</int>
|
||||
</object>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBCocoaTouchOutletConnection" key="connection">
|
||||
<string key="label">delegate</string>
|
||||
<reference key="source" ref="759518333"/>
|
||||
<reference key="destination" ref="372490531"/>
|
||||
</object>
|
||||
<int key="connectionID">24</int>
|
||||
</object>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBCocoaTouchEventConnection" key="connection">
|
||||
<string key="label">announce:</string>
|
||||
<reference key="source" ref="522544887"/>
|
||||
<reference key="destination" ref="372490531"/>
|
||||
<int key="IBEventType">7</int>
|
||||
</object>
|
||||
<int key="connectionID">27</int>
|
||||
</object>
|
||||
</array>
|
||||
<object class="IBMutableOrderedSet" key="objectRecords">
|
||||
<array key="orderedObjects">
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">0</int>
|
||||
<array key="object" id="0"/>
|
||||
<reference key="children" ref="1000"/>
|
||||
<nil key="parent"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">-1</int>
|
||||
<reference key="object" ref="372490531"/>
|
||||
<reference key="parent" ref="0"/>
|
||||
<string key="objectName">File's Owner</string>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">-2</int>
|
||||
<reference key="object" ref="843779117"/>
|
||||
<reference key="parent" ref="0"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">6</int>
|
||||
<reference key="object" ref="774585933"/>
|
||||
<array class="NSMutableArray" key="children">
|
||||
<reference ref="422181324"/>
|
||||
<reference ref="522544887"/>
|
||||
<reference ref="759518333"/>
|
||||
<reference ref="180598074"/>
|
||||
</array>
|
||||
<reference key="parent" ref="0"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">17</int>
|
||||
<reference key="object" ref="422181324"/>
|
||||
<reference key="parent" ref="774585933"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">19</int>
|
||||
<reference key="object" ref="759518333"/>
|
||||
<reference key="parent" ref="774585933"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">25</int>
|
||||
<reference key="object" ref="522544887"/>
|
||||
<reference key="parent" ref="774585933"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">28</int>
|
||||
<reference key="object" ref="180598074"/>
|
||||
<reference key="parent" ref="774585933"/>
|
||||
</object>
|
||||
</array>
|
||||
</object>
|
||||
<dictionary class="NSMutableDictionary" key="flattenedProperties">
|
||||
<string key="-1.CustomClassName">SCViewController</string>
|
||||
<string key="-1.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
||||
<string key="-2.CustomClassName">UIResponder</string>
|
||||
<string key="-2.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
||||
<string key="17.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
||||
<string key="19.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
||||
<string key="25.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
||||
<real value="3" key="25.IBUIButtonInspectorSelectedStateConfigurationMetadataKey"/>
|
||||
<string key="28.CustomClassName">FBProfilePictureView</string>
|
||||
<string key="28.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
||||
<string key="6.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
||||
</dictionary>
|
||||
<dictionary class="NSMutableDictionary" key="unlocalizedProperties"/>
|
||||
<nil key="activeLocalization"/>
|
||||
<dictionary class="NSMutableDictionary" key="localizations"/>
|
||||
<nil key="sourceID"/>
|
||||
<int key="maxID">30</int>
|
||||
</object>
|
||||
<object class="IBClassDescriber" key="IBDocument.Classes">
|
||||
<array class="NSMutableArray" key="referencedPartialClassDescriptions">
|
||||
<object class="IBPartialClassDescription">
|
||||
<string key="className">FBProfilePictureView</string>
|
||||
<string key="superclassName">UIView</string>
|
||||
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||
<string key="majorKey">IBProjectSource</string>
|
||||
<string key="minorKey">./Classes/FBProfilePictureView.h</string>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBPartialClassDescription">
|
||||
<string key="className">SCViewController</string>
|
||||
<string key="superclassName">UIViewController</string>
|
||||
<object class="NSMutableDictionary" key="actions">
|
||||
<string key="NS.key.0">announce:</string>
|
||||
<string key="NS.object.0">id</string>
|
||||
</object>
|
||||
<object class="NSMutableDictionary" key="actionInfosByName">
|
||||
<string key="NS.key.0">announce:</string>
|
||||
<object class="IBActionInfo" key="NS.object.0">
|
||||
<string key="name">announce:</string>
|
||||
<string key="candidateClassName">id</string>
|
||||
</object>
|
||||
</object>
|
||||
<dictionary class="NSMutableDictionary" key="outlets">
|
||||
<string key="announceButton">UIButton</string>
|
||||
<string key="menuTableView">UITableView</string>
|
||||
<string key="userNameLabel">UILabel</string>
|
||||
<string key="userProfileImage">FBProfilePictureView</string>
|
||||
</dictionary>
|
||||
<dictionary class="NSMutableDictionary" key="toOneOutletInfosByName">
|
||||
<object class="IBToOneOutletInfo" key="announceButton">
|
||||
<string key="name">announceButton</string>
|
||||
<string key="candidateClassName">UIButton</string>
|
||||
</object>
|
||||
<object class="IBToOneOutletInfo" key="menuTableView">
|
||||
<string key="name">menuTableView</string>
|
||||
<string key="candidateClassName">UITableView</string>
|
||||
</object>
|
||||
<object class="IBToOneOutletInfo" key="userNameLabel">
|
||||
<string key="name">userNameLabel</string>
|
||||
<string key="candidateClassName">UILabel</string>
|
||||
</object>
|
||||
<object class="IBToOneOutletInfo" key="userProfileImage">
|
||||
<string key="name">userProfileImage</string>
|
||||
<string key="candidateClassName">FBProfilePictureView</string>
|
||||
</object>
|
||||
</dictionary>
|
||||
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||
<string key="majorKey">IBProjectSource</string>
|
||||
<string key="minorKey">./Classes/SCViewController.h</string>
|
||||
</object>
|
||||
</object>
|
||||
</array>
|
||||
</object>
|
||||
<int key="IBDocument.localizationMode">0</int>
|
||||
<string key="IBDocument.TargetRuntimeIdentifier">IBCocoaTouchFramework</string>
|
||||
<object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDependencyDefaults">
|
||||
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS</string>
|
||||
<real value="1296" key="NS.object.0"/>
|
||||
</object>
|
||||
<bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool>
|
||||
<int key="IBDocument.defaultPropertyAccessControl">3</int>
|
||||
<string key="IBCocoaTouchPluginVersion">1181</string>
|
||||
</data>
|
||||
</archive>
|
||||
@@ -0,0 +1,4 @@
|
||||
/*
|
||||
Scrumptious
|
||||
Scrumptious
|
||||
*/
|
||||
@@ -0,0 +1,4 @@
|
||||
/*
|
||||
Scrumptious
|
||||
Scrumptious
|
||||
*/
|
||||
|
After Width: | Height: | Size: 2.7 KiB |
|
After Width: | Height: | Size: 3.1 KiB |
|
After Width: | Height: | Size: 2.5 KiB |
|
After Width: | Height: | Size: 3.0 KiB |
|
After Width: | Height: | Size: 3.1 KiB |
@@ -0,0 +1,27 @@
|
||||
/*
|
||||
* Copyright 2010-present Facebook.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#import <Accounts/ACAccountStore.h>
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
#import "SCAppDelegate.h"
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
@autoreleasepool {
|
||||
return UIApplicationMain(argc, argv, nil, NSStringFromClass([SCAppDelegate class]));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>en</string>
|
||||
<key>CFBundleDisplayName</key>
|
||||
<string>Scrumptious</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>${EXECUTABLE_NAME}</string>
|
||||
<key>CFBundleIcons</key>
|
||||
<dict>
|
||||
<key>CFBundlePrimaryIcon</key>
|
||||
<dict>
|
||||
<key>CFBundleIconFiles</key>
|
||||
<array>
|
||||
<string>Icon.png</string>
|
||||
<string>Icon@2x.png</string>
|
||||
<string>Icon-72.png</string>
|
||||
</array>
|
||||
</dict>
|
||||
</dict>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>com.facebook.${PRODUCT_NAME:rfc1034identifier}</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>${PRODUCT_NAME}</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleURLTypes</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>CFBundleURLSchemes</key>
|
||||
<array>
|
||||
<string>fb233936543368280</string>
|
||||
</array>
|
||||
</dict>
|
||||
</array>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>${FB_BUNDLE_VERSION}</string>
|
||||
<key>FacebookAppID</key>
|
||||
<string>233936543368280</string>
|
||||
<key>FacebookDisplayName</key>
|
||||
<string>Scrumptious</string>
|
||||
<key>FacebookBundleName</key>
|
||||
<string>FacebookSDKOverrides</string>
|
||||
<key>LSRequiresIPhoneOS</key>
|
||||
<true/>
|
||||
<key>UIRequiredDeviceCapabilities</key>
|
||||
<array>
|
||||
<string>armv7</string>
|
||||
</array>
|
||||
<key>UISupportedInterfaceOrientations</key>
|
||||
<array>
|
||||
<string>UIInterfaceOrientationPortrait</string>
|
||||
</array>
|
||||
</dict>
|
||||
</plist>
|
||||
@@ -0,0 +1,24 @@
|
||||
/*
|
||||
* Copyright 2012 Facebook
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
//
|
||||
// Prefix header for all source files of the 'Scrumptious' target in the 'Scrumptious' project
|
||||
//
|
||||
|
||||
#ifdef __OBJC__
|
||||
#import <UIKit/UIKit.h>
|
||||
#import <Foundation/Foundation.h>
|
||||
#endif
|
||||