Skip to content

Commit

Permalink
Fork UIExplorer.xcodeproj into UIExplorerCxx.xcodeproj
Browse files Browse the repository at this point in the history
Reviewed By: javache

Differential Revision: D4434102

fbshipit-source-id: 45e128e7d985b58c04dda14f8e692051a552a491
  • Loading branch information
mhorowitz authored and facebook-github-bot committed Feb 1, 2017
1 parent aeab15d commit 81b2d69
Show file tree
Hide file tree
Showing 6 changed files with 2,289 additions and 7 deletions.
9 changes: 2 additions & 7 deletions Examples/UIExplorer/UIExplorer/AppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,8 @@ - (BOOL)application:(__unused UIApplication *)application didFinishLaunchingWith

- (NSURL *)sourceURLForBridge:(__unused RCTBridge *)bridge
{
NSURL *jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"Examples/UIExplorer/js/UIExplorerApp.ios"
fallbackResource:nil];
if (!getenv("CI_USE_PACKAGER")) {
jsCodeLocation = [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
}

return jsCodeLocation;
return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"Examples/UIExplorer/js/UIExplorerApp.ios"
fallbackResource:nil];
}


Expand Down
1 change: 1 addition & 0 deletions Examples/UIExplorer/UIExplorer/main.m
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
*/

#import <UIKit/UIKit.h>

#import "AppDelegate.h"

int main(int argc, char * argv[]) {
Expand Down
28 changes: 28 additions & 0 deletions Examples/UIExplorer/UIExplorer/maincxx.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
// Copyright 2004-present Facebook. All Rights Reserved.

/**
* The examples provided by Facebook are for non-commercial testing and
* evaluation purposes only.
*
* Facebook reserves all rights not expressly granted.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL
* FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/

#import <UIKit/UIKit.h>

#import <React/RCTCxxBridge.h>

#import "AppDelegate.h"

int main(int argc, char * argv[]) {
@autoreleasepool {
[RCTCxxBridge enable];
return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
}
}
Loading

7 comments on commit 81b2d69

@janicduplessis
Copy link
Contributor

@janicduplessis janicduplessis commented on 81b2d69 Mar 1, 2017

Choose a reason for hiding this comment

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

@mhorowitz I was trying to get the cxx bridge working in my app and was hitting compile issues about missing headers. Then I tried running UIExplorer with UIExplorerCxx.xcodeproj and hit similar compile errors. Could you verify if it works for you? I'm not sure why the error happens but it seems like the react code doesn't get compiled / headers copied before it tries to build other projects like RCTActionSheet.

@mhorowitz
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@janicduplessis thanks for taking the time to try out the new bridge!

I fetched a fresh copy of RN from github and tried to build it myself. It looks like there were a few regressions in the form of some renames and new files, but nothing related to RCTActionSheet, or that looks like ordering.

I've committed a fix for the problems I was seeing (218e37d), and here's what I did to confirm everything is working:

git clone https://github.com/facebook/react-native.git
cd react-native/
./ios-install-third-party.sh
yarn install
open Examples/UIExplorer/UIExplorerCxx.xcodeproj
Make sure the UIExplorer scheme is selected, and ⌘R

If you're seeing problems which look like dependency ordering, check the Build tab of your scheme, and make sure "Parallelize Build" is unchecked.

Definitely let me know if you have any more issues or questions. I'm working now on making this a bit more seamless to drop in so people can test with it more easily.

@janicduplessis
Copy link
Contributor

Choose a reason for hiding this comment

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

@mhorowitz Cool, I think I just realize what my issue was, I had RCTActionSheet as the selected project to build instead of UIExplorer... Xcode -_-

Going to try it in my app too now, is there anything else I have to do to convert my existing project to a cxx bridge one except to remove React.xcproj and add CxxReact.xcproj?

@janicduplessis
Copy link
Contributor

Choose a reason for hiding this comment

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

Ok I figured it out, I also had to go in the build section of my scheme and remove the missing React dependency from the React project and add it back from the CxxReact project

@janicduplessis
Copy link
Contributor

Choose a reason for hiding this comment

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

@mhorowitz Found an issue when trying to generate an archive. Looks like double-conversion doesn't work when building for generic ios device. You can repro in xcode by choosing 'Generic iOS Device' as the target and building.

Target architecture was not detected as supported by Double-Conversion.

@mhorowitz
Copy link
Contributor Author

@mhorowitz mhorowitz commented on 81b2d69 Mar 7, 2017

Choose a reason for hiding this comment

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

double-conversion-1.1.5 fixes this. I'm working on an update now.

@mhorowitz
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fix here cb3a439

Please sign in to comment.