本机iOS发布版本无法启动

时间:2017-03-22 11:04:23

标签: react-native

我在发布我的react-native应用程序的iOS版本时遇到了问题。

使用调试方案时,一切都按预期工作,但是一旦我更改为发布方案,只有初始和自动首次启动才有效。如果我关闭并重新打开应用程序,它会立即关闭。

有没有人经历过类似的事情?或者有关于如何调试此类问题的建议?

非常感谢任何帮助!

修改:显示行为的简短视频:https://vid.me/6kkB

AppDeletegate.m

#import "AppDelegate.h"

#import <React/RCTBundleURLProvider.h>
#import <React/RCTRootView.h>
#import <FBSDKCoreKit/FBSDKCoreKit.h>
@import GooglePlaces;
@import GoogleMaps;

@implementation AppDelegate

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
  NSURL *jsCodeLocation;

  [GMSPlacesClient provideAPIKey:@"AIzaSyDHHSswYLWfcoKIjwSWDecBqib6r1fDMsc"];
  [GMSServices provideAPIKey:@"AIzaSyDHHSswYLWfcoKIjwSWDecBqib6r1fDMsc"];
  [[FBSDKApplicationDelegate sharedInstance] application:application
                           didFinishLaunchingWithOptions:launchOptions];

  // Dev
  jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index.ios" fallbackResource:nil];

  // Release
  //jsCodeLocation = [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];

  RCTRootView *rootView = [[RCTRootView alloc] initWithBundleURL:jsCodeLocation
                                                      moduleName:@"get"
                                               initialProperties:nil
                                                   launchOptions:launchOptions];
  rootView.backgroundColor = [[UIColor alloc] initWithRed:1.0f green:1.0f blue:1.0f alpha:1];

  self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
  UIViewController *rootViewController = [UIViewController new];
  rootViewController.view = rootView;
  self.window.rootViewController = rootViewController;
  [self.window makeKeyAndVisible];
  return YES;
}

- (BOOL)application:(UIApplication *)application 
            openURL:(NSURL *)url 
            options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options {

  BOOL handled = [[FBSDKApplicationDelegate sharedInstance] application:application
    openURL:url
    sourceApplication:options[UIApplicationOpenURLOptionsSourceApplicationKey]
    annotation:options[UIApplicationOpenURLOptionsAnnotationKey]
  ];
  // Add any custom logic here.
  return handled;
}



@end

1 个答案:

答案 0 :(得分:0)

当我遇到这个问题时,对我有用的东西很简单:

  • 清洁项目
  • 关闭项目,退出xCode
  • 重新启动xCode,Build&amp;运行

并密切注意包装终端..有时它会挂起或甚至不会启动。然后可以使用npm start

手动启动