2016-08-08 36 views
14

khi tôi khởi động ứng dụng gốc phản ứng, nó luôn bắt đầu, miễn là tôi có kết nối với mac.cách gỡ lỗi khi phản ứng ứng dụng gốc không bắt đầu trên thiết bị ios

Ngay sau khi tôi ngắt kết nối iphone, ứng dụng chủ yếu bị treo khi khởi động và treo, mà không có bất kỳ thông báo lỗi nào khác. Nhưng, các lỗi khác sẽ hiển thị trên màn hình (lỗi cờ đỏ và vàng).

Khi tôi doubleclick homebutton, lạ thay, ứng dụng có vẻ ở trạng thái bắt đầu, nhưng tôi không thể chuyển sang nó.

Làm cách nào bạn có thể gỡ lỗi hành vi như vậy tốt nhất và tìm ra những thứ gây ra hành vi khởi động lạ?

Cập nhật:

tôi tìm thấy những lỗi

2016-08-08 16:25:23.604 [warn][tid:main][RCTEventEmitter.m:54] Sending `websocketFailed` with no listeners registered. 
2016-08-08 16:25:23.612113 PhoenixApp[525:64778] Sending `websocketFailed` with no listeners registered. 
2016-08-08 16:25:23.742 [warn][tid:com.facebook.react.JavaScript] The regenerator/runtime module is deprecated; please import regenerator-runtime/runtime instead. 
2016-08-08 16:25:23.741927 PhoenixApp[525:65027] The regenerator/runtime module is deprecated; please import regenerator-runtime/runtime instead. 
2016-08-08 16:25:23.860 [info][tid:com.facebook.react.JavaScript] Running application "PhoenixApp" with appParams: {"rootTag":1,"initialProps":{}}. __DEV__ === true, development-level warning are ON, performance optimizations are OFF 
2016-08-08 16:25:23.860251 PhoenixApp[525:65027] Running application "PhoenixApp" with appParams: {"rootTag":1,"initialProps":{}}. __DEV__ === true, development-level warning are ON, performance optimizations are OFF 
2016-08-08 16:25:24.139 [info][tid:com.facebook.react.JavaScript] null 
2016-08-08 16:25:24.138808 PhoenixApp[525:65027] null 

tiếp theo (mỗi giây)

2016-08-08 16:31:43.159749 PhoenixApp[525:64956] [] __nw_connection_get_connected_socket_block_invoke 176 Connection has no connected handler 
2016-08-08 16:31:45.372329 PhoenixApp[525:65445] [] __nw_connection_get_connected_socket_block_invoke 177 Connection has no connected handler 
2016-08-08 16:31:47.575208 PhoenixApp[525:64955] [] __nw_connection_get_connected_socket_block_invoke 178 Connection has no connected handler 
2016-08-08 16:31:49.788935 PhoenixApp[525:65445] [] __nw_connection_get_connected_socket_block_invoke 179 Connection has no connected handler 
2016-08-08 16:31:51.970877 PhoenixApp[525:64955] [] __nw_connection_get_connected_socket_block_invoke 180 Connection has no connected handler 
2016-08-08 16:31:54.173791 PhoenixApp[525:65445] [] __nw_connection_get_connected_socket_block_invoke 181 Connection has no connected handler 

AppDelegate.m

/** 
* Copyright (c) 2015-present, Facebook, Inc. 
* All rights reserved. 
* 
* This source code is licensed under the BSD-style license found in the 
* LICENSE file in the root directory of this source tree. An additional grant 
* of patent rights can be found in the PATENTS file in the same directory. 
*/ 

#import "AppDelegate.h" 

#import "RCTBundleURLProvider.h" 
#import "RCTRootView.h" 

@implementation AppDelegate 

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

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

    RCTRootView *rootView = [[RCTRootView alloc] initWithBundleURL:jsCodeLocation 
                 moduleName:@"PhoenixTrello" 
               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; 
} 

@end 

thiết lập:

phản ứng bản địa-cli: 1.0.0 phản ứng bản địa: 0.32.0-rc.0 phản ứng: 15.3.0

Xcode 8 beta 4, iOS 10

+0

Bạn có nhận được bất kỳ lỗi nào trên xcode ngay trước khi ngắt kết nối thiết bị? bạn đã thử hiển thị một thành phần trống ở gốc ứng dụng của bạn và xem nó có hoạt động không? Cố gắng thu hẹp xuống nếu vấn đề nằm trong mã JS hoặc phần gốc của bạn. Bạn đang sử dụng phiên bản gốc phản ứng nào? – nabn

+0

ok, Ill hãy thử điều đó. Vấn đề vẫn tồn tại kể từ versino 0,28, bây giờ tôi đang sử dụng 0,32.rc-0 – radosch

+0

Tôi đã cập nhật Câu hỏi có lỗi, trong khi thiết bị được đính kèm. – radosch

Trả lời

5

Cố gắng xây dựng ứng dụng trong phiên bản chế độ.

Chỉnh sửa chương trình

  • Chọn Run tab
  • Chọn Info
  • Thay đổi cấu hình xây dựng chuẩn bị tung ra
  • xây dựng và chạy dự án

Trong khi thiết bị của bạn được kết nối với Xcode, xCode thực hiện một số hành động/tối ưu hóa và đính kèm trình gỡ lỗi. Đôi khi hành động này ngăn không hiển thị lỗi. Nếu bạn chạy ứng dụng của mình ở chế độ phát hành, hành động này sẽ bị bỏ qua và lỗi ứng dụng.

+0

Cảm ơn rất nhiều! Tôi đã cố gắng để có được nhiều hơn infos (xem câu hỏi cập nhật) có thể là bạn có một đầu mối? – radosch

0

bạn đã thử xây dựng jsBundle để sử dụng Ứng dụng ngoại tuyến chưa. ?

+0

điều này sẽ được thực hiện tự động? isnt 'it? Tôi cập nhật bài đăng với AppDelegate.m – radosch

0

Tôi đã gặp lỗi này vì ứng dụng đang gọi API để nhận dữ liệu từ máy chủ từ xa và thiết bị không có kết nối internet. Lỗi đã biến mất khi thiết bị được kết nối với internet.

0

Trong thư mục ios, tìm và thay thế mã trong Thông tin.plist file:

<key>NSAppTransportSecurity</key> 
    <dict> 
     <key>NSAllowsArbitraryLoads</key> 
     <false/> 
     <key>NSExceptionDomains</key> 
     <dict> 
      <key>localhost</key> 
      <dict> 
       <key>NSTemporaryExceptionAllowsInsecureHTTPLoads</key> 
       <true/> 
      </dict> 
     </dict> 
    </dict> 

với

<key>NSAppTransportSecurity</key> 
    <dict> 
     <key>NSAllowsArbitraryLoads</key> 
     <true/> 
    </dict> 

Sau đó, chạy: react-native run-ios

Các vấn đề liên quan