Skip to content
Browse files

Merge pull request #4 from ojfoggin/master

Merge in change from ojfoggin - Changed fetchMe to a convenience for fetchMeWIthParameters.
  • Loading branch information...
2 parents abe7994 + 9fa1efc commit 38ea3e98ae660e91ca406c18d8fcc051113557e1 @hiddenmemory committed Jun 7, 2012
Showing with 52 additions and 5 deletions.
  1. +38 −0 src/Facebook+Graph.h
  2. +14 −5 src/Facebook+Graph.m
View
38 src/Facebook+Graph.h
@@ -22,7 +22,45 @@
- (NSArray*)permissionsRequired;
+#define kFBFieldName @"name"
+#define kFBFieldFirstName @"first_name"
+#define kFBFieldMiddleName @"middle_name"
+#define kFBFieldLastName @"last_name"
+#define kFBFieldGender @"gender"
+#define kFBFieldLocale @"locale"
+#define kFBFieldLanguages @"languages"
+#define kFBFieldLink @"link"
+#define kFBFieldUsername @"username"
+#define kFBFieldThirdPartyID @"third_party_id"
+#define kFBFieldnstalled @"installed"
+#define kFBFieldTimeZone @"timezone"
+#define kFBFieldUpdatedTime @"updated_time"
+#define kFBFieldVerified @"verified"
+#define kFBFieldBio @"bio"
+#define kFBFieldBirthday @"birthday"
+#define kFBFieldCover @"cover"
+#define kFBFieldEducation @"education"
+#define kFBFieldEmail @"email"
+#define kFBFieldHomeTown @"hometown"
+#define kFBFieldInterestedIn @"interested_in"
+#define kFBFieldLocation @"location"
+#define kFBFieldPolitical @"political"
+#define kFBFieldFavoriteAthletes @"favorite_athletes"
+#define kFBFieldFavoriteTeams @"favorite_teams"
+#define kFBFieldPicture @"picture"
+#define kFBFieldQuotes @"quotes"
+#define kFBFieldRelationshipStatus @"relationship_status"
+#define kFBFieldReligion @"religion"
+#define kFBFieldSignificantOther @"significant_other"
+#define kFBFieldVideoUploadLimits @"video_upload_limits"
+#define kFBFieldWebsite @"website"
+#define kFBFieldWork @"work"
+
#pragma mark - me
+- (void)fetchMeWithParameters:(NSDictionary*)parameters
+ completion:(void(^)(NSDictionary *me))completionHandler
+ error:(void(^)(NSError *error))errorHandler;
+
- (void)fetchMe:(void(^)(NSDictionary *me))completionHandler
error:(void(^)(NSError *error))errorHandler;
View
19 src/Facebook+Graph.m
@@ -39,8 +39,8 @@ @implementation Facebook (Graph)
static NSString *const kFBSearchTypePlace = @"place";
static NSString *const kFBSearchTypeCheckIn = @"checkin";
-static NSString *const kFBFieldName = @"name";
-static NSString *const kFBFieldPicture = @"picture";
+//static NSString *const kFBFieldName = @"name";
+//static NSString *const kFBFieldPicture = @"picture";
- (NSArray*)permissionsRequired {
return [NSArray arrayWithObjects:
@@ -53,13 +53,14 @@ - (NSArray*)permissionsRequired {
}
#pragma mark - me
-- (void)fetchMe:(void(^)(NSDictionary *me))completionHandler
- error:(void(^)(NSError *error))errorHandler {
+- (void)fetchMeWithParameters:(NSDictionary*)parameters
+ completion:(void(^)(NSDictionary *me))completionHandler
+ error:(void(^)(NSError *error))errorHandler {
[self usingPermission:@"user_about_me" request:^( BOOL success ) {
if( success ) {
[self requestWithGraphPath:@"me"
- parameters:[NSDictionary dictionaryWithObjectsAndKeys:@"name,picture", @"fields", nil]
+ parameters:parameters
completion:^(FBRequest *request, id result) {
if( completionHandler ) {
completionHandler(result);
@@ -79,6 +80,14 @@ - (void)fetchMe:(void(^)(NSDictionary *me))completionHandler
}];
}
+- (void)fetchMe:(void(^)(NSDictionary *me))completionHandler
+ error:(void(^)(NSError *error))errorHandler {
+
+ [self fetchMeWithParameters:[NSDictionary dictionaryWithObjectsAndKeys:[NSString stringWithFormat:@"%@,%@", kFBFieldName, kFBFieldPicture], @"fields", nil]
+ completion:completionHandler
+ error:errorHandler];
+}
+
- (void)fetchProfilePictureWithID:(NSString *)ID
completion:(void (^)(UIImage *picture))completionHandler
error:(void (^)(NSError *error))errorHandler {

0 comments on commit 38ea3e9

Please sign in to comment.
Something went wrong with that request. Please try again.