Skip to content

Commit

Permalink
Replace deprecated completion block
Browse files Browse the repository at this point in the history
Summary:
`UIActivityViewConroller.completionHandler` has been [deprecated](https://developer.apple.com/reference/uikit/uiactivityviewcontroller/1622010-completionhandler) since iOS 8, when it was replaced by `completionWithItemsHandler`.

Tested the build using `UIExplorer` and XCode 8.2 but I've never seen and can't work out how to activate the `UIActivityViewController` this method relates to, so I haven't tested a real run.
Closes #11798

Differential Revision: D4396618

fbshipit-source-id: 92a993c434637ede2d5779f4154feb00d2c78d06
  • Loading branch information
robhogan authored and facebook-github-bot committed Jan 10, 2017
1 parent 2d8a287 commit 453e70d
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion React/Profiler/RCTProfile.m
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,10 @@ + (void)toggle:(UIButton *)target
#if !TARGET_OS_TV
UIActivityViewController *activityViewController = [[UIActivityViewController alloc] initWithActivityItems:@[[NSURL fileURLWithPath:outFile]]
applicationActivities:nil];
activityViewController.completionHandler = ^(__unused NSString *activityType, __unused BOOL completed) {
activityViewController.completionWithItemsHandler = ^(__unused UIActivityType activityType,
__unused BOOL completed,
__unused NSArray *items,
__unused NSError *error) {
RCTProfileControlsWindow.hidden = NO;
};
RCTProfileControlsWindow.hidden = YES;
Expand Down

7 comments on commit 453e70d

@Petermuturi
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After this change was made, I always get an error running react-native run-ios, and always have to revert back this on my node_modules. Please fix.

@swoopyy
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same story. Fails to compile because of this.

@ide
Copy link
Contributor

@ide ide commented on 453e70d Mar 16, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What version of Xcode are you using? Perhaps it is old?

@Petermuturi
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually figured out you cannot run the latest stable react-native version if you are not running on OS Sierra, (for you to have the latest version of Xcode)

@ide
Copy link
Contributor

@ide ide commented on 453e70d Apr 4, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In general, React Native usually supports and sometimes requires the latest version of macOS and Xcode, so update frequently.

@gigeos
Copy link

@gigeos gigeos commented on 453e70d Apr 12, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a breaking change for me too. I use Xode 7.3 and iOS 9.0:

Incompatible block pointer types assigning to 'UIActivityViewControllerCompletionWithItemsHandler _Nullable' (aka 'void (^)(NSString * _Nullable __strong, BOOL, NSArray * _Nullable __strong, NSError * _Nullable __strong)') from 'int ((^)(void))'

and

Expected ')'

@ide
Copy link
Contributor

@ide ide commented on 453e70d Apr 12, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like this changed in RN 0.42 -- I added a mention of this breaking change to the release notes. I think the release maintainers didn't encounter this issue because they (and the test suites) are using the latest version of Xcode. https://github.com/facebook/react-native/releases/tag/v0.42.3

Generally speaking, the latest major version of Xcode (e.g. the 8.x releases) is the only supported version. Sometimes when a new version of Xcode has just come out, the older version is supported for awhile but you should upgrade in a timely manner.

Please sign in to comment.