LiquidPlayer / LiquidCore

Node.js virtual machine for Android and iOS
MIT License
1.01k stars 127 forks source link

iOS crash if build without use_frameworks! #124

Closed Johnnie-C closed 4 years ago

Johnnie-C commented 5 years ago

OS: macOS 10.14 (18A391) Xcode: 10.1 (10B61) Pod: 1.7.5 LiquidCore: 0.6.2

I am able to run a demo with MicroService in pure swift project. However, I cannot use use_frameworks! in my project due to other complicated reasons. I am able to build the product, but it crashes after LCMicroService is started.

I have attached my codes below. Can you please check it? Let me know if there is any misconfiguration. Thanks.

podfile:

target 'Demo' do
  # Comment the next line if you're not using Swift and don't want to use dynamic frameworks
  # use_frameworks!

  # Pods for Demo
  pod 'LiquidCore'

  target 'DemoTests' do
    inherit! :search_paths
    # Pods for testing
  end

  target 'DemoUITests' do
    inherit! :search_paths
    # Pods for testing
  end

end

ViewController.m:

#import "ViewController.h"
#import <LiquidCore/LiquidCore.h>

@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];

    //got crash on all types of urls (local server, local js bundle, online js)
//    NSURL *url = [NSURL URLWithString:@"https://github.githubassets.com/assets/frameworks-bcbd0e07.js"];
//    NSURL *url = [[NSBundle mainBundle] URLForResource:@"test_js" withExtension:@"js"];
    NSURL *url = [LCMicroService devServer];
    LCMicroService *service = [[LCMicroService alloc] initWithURL:url];
    [service start];
}

@end

error:

:494
<Source line not available>

anon@[native code]:2:17
[native code]
Function@[native code]:2:268
bootstrap_node.js:494:43
anon@[native code]:2:16
ericwlange commented 5 years ago

Unfortunately use_frameworks! is required. I don't really know why, but I have never been able to get it to work without it. You can leave this issue open, but since there is a workaround (to use frameworks), it will remain a low priority for me to fix, as it is not so much a bug as a limitation.

If you are able to figure out a better solution, please feel free to file a PR.

ericwlange commented 4 years ago

Closing this issue. use_frameworks! is required.