Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Addresses a few issues for hotfix

Summary:
Issues addressed here are -
* Fix to FBGraphUser
* Removal of date handling on post, and relevant fix to unit tests
* Sample fix to use modern permission
* Nil of delegate in Facebook.m

Test Plan: Ran related unit tests and samples

Reviewers: clang, karthiks, ayden, gregschechte

Reviewed By: clang

CC: msdkexp@, platform-diffs@lists

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

Task ID: 1382325
  • Loading branch information...
commit 01e476b3da46efa8e608eff5baaca4b45bcbcf8a 1 parent a54ef24
Jason Clark authored
View
2  samples/HelloFacebookSample/HelloFacebookSample/HFViewController.m
@@ -57,7 +57,7 @@ - (void)viewDidLoad {
// Create Login View so that the app will be granted "status_update" permission.
FBLoginView *loginview =
- [[FBLoginView alloc] initWithPermissions:[NSArray arrayWithObject:@"status_update"]];
+ [[FBLoginView alloc] initWithPermissions:[NSArray arrayWithObject:@"publish_actions"]];
loginview.frame = CGRectOffset(loginview.frame, 5, 5);
loginview.delegate = self;
View
4 src/FBGraphUser.h
@@ -15,7 +15,7 @@
*/
#import <Foundation/Foundation.h>
-#import "FBGraphLocation.h"
+#import "FBGraphPlace.h"
#import "FBGraphObject.h"
/*!
@@ -85,6 +85,6 @@
@property
@abstract Typed access to the user's current city.
*/
-@property (retain, nonatomic) id<FBGraphLocation> location;
+@property (retain, nonatomic) id<FBGraphPlace> location;
@end
View
11 src/FBRequestConnection.m
@@ -864,17 +864,6 @@ + (void)processGraphObjectPropertyKey:(NSString*)key
[value isKindOfClass:[NSNumber class]]) {
// Just serialize these.
action(key, value);
- } else if ([value isKindOfClass:[NSDate class]]) {
- // The "Events Timezone" platform migration affects what date/time formats Facebook accepts and returns.
- // Apps created after 8/1/12 (or apps that have explicitly enabled the migration) should send/receive
- // dates in ISO-8601 format. Pre-migration apps can send as Unix timestamps. Since the future is ISO-8601,
- // that is what we support here. Apps that need pre-migration behavior can explicitly send these as
- // integer timestamps rather than NSDates.
- NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
- [dateFormatter setDateFormat:@"yyyy-MM-dd'T'HH:mm:ssZ"];
-
- value = [dateFormatter stringFromDate:value];
- action(key, value);
} else if ([value isKindOfClass:[NSArray class]]) {
// Arrays are serialized as multiple elements with keys of the
// form key[0], key[1], etc.
View
14 src/FBSettings.m
@@ -36,14 +36,6 @@
NSTimeInterval const FBPublishDelay = 0.1;
-@protocol FBActivity<FBGraphObject>
-
-@property (retain, nonatomic) NSString *event;
-@property (retain, nonatomic) NSString *attribution;
-
-@end
-
-
@implementation FBSettings
static NSSet *g_loggingBehavior;
@@ -120,9 +112,9 @@ + (void)publishInstall:(NSString *)appID {
[[result objectForKey:FBSupportsAttribution] boolValue]) {
// set up the HTTP POST to publish the attribution ID.
NSString *publishPath = [NSString stringWithFormat:FBPublishActivityPath, appID, nil];
- id<FBActivity> installActivity = (id<FBActivity>)[FBGraphObject graphObject];
- installActivity.event = FBMobileInstallEvent;
- installActivity.attribution = attributionID;
+ NSMutableDictionary<FBGraphObject> *installActivity = [FBGraphObject graphObject];
+ [installActivity setObject:FBMobileInstallEvent forKey:@"event"];
+ [installActivity setObject:attributionID forKey:@"attribution"];
FBRequest *publishRequest = [[[FBRequest alloc] initForPostWithSession:nil graphPath:publishPath graphObject:installActivity] autorelease];
[publishRequest startWithCompletionHandler:publishCompletionBlock];
View
1  src/Facebook.m
@@ -150,6 +150,7 @@ - (void)dealloc {
}
[_lastAccessTokenUpdate release];
[_requests release];
+ _fbDialog.delegate = nil;
[_fbDialog release];
[_appId release];
[_urlSchemeSuffix release];
View
27 src/tests/FBGraphObjectTests.m
@@ -158,6 +158,19 @@ - (void)testGraphObjectTypedRequest
[blocker wait];
}
+- (void)testGraphObjectTypedRequest2
+{
+ FBTestBlocker *blocker = [[[FBTestBlocker alloc] init] autorelease];
+ [FBRequestConnection startWithGraphPath:@"4" // Zuck
+ completionHandler:^(FBRequestConnection *connection, id<FBGraphUser> zuck, NSError *error) {
+ STAssertTrue([zuck.first_name isEqualToString:@"Mark"], @"zuck != zuck");
+ STAssertTrue([zuck.last_name isEqualToString:@"Zuckerberg"], @"zuck != zuck");
+ [blocker signal];
+ }];
+
+ [blocker wait];
+}
+
- (void)testGraphObjectSameID
{
NSString *anID = @"1234567890";
@@ -315,12 +328,22 @@ - (void)testCommentRoundTrip
- (id)postEvent
{
id<FBGraphObject> event = [FBGraphObject graphObject];
- NSDate *startTime = [NSDate dateWithTimeIntervalSinceNow:24 * 3600];
+
+ // The "Events Timezone" platform migration affects what date/time formats Facebook accepts and returns.
+ // Apps created after 8/1/12 (or apps that have explicitly enabled the migration) should send/receive
+ // dates in ISO-8601 format. Pre-migration apps can send as Unix timestamps. Since the future is ISO-8601,
+ // that is what we support here. Apps that need pre-migration behavior can explicitly send these as
+ // integer timestamps rather than NSDates.
+ NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
+ [dateFormatter setDateFormat:@"yyyy-MM-dd'T'HH:mm:ssZ"];
+ id startTime = [NSDate dateWithTimeIntervalSinceNow:24 * 3600];
+ id endTime = [dateFormatter stringFromDate:[NSDate dateWithTimeInterval:3600 sinceDate:startTime]];
+ startTime = [dateFormatter stringFromDate:startTime];
+
[event setObject:[NSString stringWithFormat:@"My event on %@", startTime]
forKey:@"name"];
[event setObject:@"This is a great event. You should all come."
forKey:@"description"];
- NSDate *endTime = [NSDate dateWithTimeInterval:3600 sinceDate:startTime];
[event setObject:startTime forKey:@"start_time"];
[event setObject:endTime forKey:@"end_time"];
[event setObject:@"My house" forKey:@"location"];
Please sign in to comment.
Something went wrong with that request. Please try again.