Я пытаюсь запустить свое NativeScript-приложение на эмуляторах iOS.Так как iTunes хочет, чтобы приложения публиковались в Xcode 9.0 или более поздней версии, мне пришлось обновить NativeScript iOS v3.1 с Xcode 7.3 (где мое приложение работало отлично) до NativeScript iOS v4.2 с Xcode 9.0.Теперь, к сожалению, я не могу запустить свое приложение на любом устройстве.Он запускается полностью, и я вижу загрузочный экран, а затем он сталкивается с этой ошибкой:
CONSOLE ERROR file:///app/tns_modules/zone.js/dist/zone-node.js:419:27: Unhandled Promise rejection: UIScreen.mainScreen is not a function. (In 'UIScreen.mainScreen()', 'UIScreen.mainScreen' is an instance of UIScreen) ; Zone: angular ; Task: Promise.then ; Value: TypeError: UIScreen.mainScreen is not a function. (In 'UIScreen.mainScreen()', 'UIScreen.mainScreen' is an instance of UIScreen)
CONSOLE ERROR file:///app/tns_modules/zone.js/dist/zone-node.js:421:23: Error: Uncaught (in promise): TypeError: UIScreen.mainScreen is not a function. (In 'UIScreen.mainScreen()', 'UIScreen.mainScreen' is an instance of UIScreen)
Когда я возвращаюсь в Xcode 7.3 с NativeScript-iOS 3.1.0, он снова прекрасно работает.Я понятия не имею, что я могу сделать, чтобы решить эту проблему.
Я видел некоторые связанные вопросы с ошибками UIScreen.MainScreen (например, здесь ), но они, похоже, связаны с родной iOS.на который я не могу влиять из NativeScript (по крайней мере, я не знаю, как я мог).
Теперь вот некоторые вещи из моей конфигурации:
package.json:
{ //...
"tns-ios": {
"version": "4.2.0"
}
},
"dependencies": {
"@angular/common": "2.0.0-rc.4",
"@angular/compiler": "2.0.0-rc.4",
"@angular/core": "2.0.0-rc.4",
"@angular/http": "2.0.0-rc.4",
"@angular/platform-browser": "2.0.0-rc.4",
"@angular/platform-browser-dynamic": "2.0.0-rc.4",
"@angular/platform-server": "2.0.0-rc.4",
"@angular/router": "3.0.0-beta.2",
"nativescript-angular": "0.3.1-2016-08-04-787",
"nativescript-calendar": "1.1.2",
"nativescript-drop-down": "1.3.2",
"nativescript-fresco": "1.0.6",
"nativescript-ng2-translate": "1.1.1",
"nativescript-social-share": "1.3.0",
"nativescript-telerik-ui": "1.3.1",
"ng2-translate": "2.2.2",
"reflect-metadata": "^0.1.3",
"rxjs": "5.0.0-beta.6",
"tns-core-modules": "^2.4.4",
"typescript": "^1.8.10",
"url": "0.10.3",
"zone.js": "0.6.12"
},
"devDependencies": {
"babel-traverse": "6.10.4",
"babel-types": "6.10.2",
"babylon": "6.8.1",
"filewalker": "0.1.3",
"lazy": "1.0.11",
"nativescript-dev-typescript": "0.3.2",
"nativescript-dev-webpack": "0.0.20",
"typescript": "1.8.10"
}
}
build.xcconfig:
CODE_SIGN_IDENTITY = iPhone Developer;
DEVELOPMENT_TEAM = %Number%;
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;
IPHONEOS_DEPLOYMENT_TARGET = 8.1;
info.plist:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleDisplayName</key>
<string>%App_Name%</string>
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>${PRODUCT_NAME}</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>2.0.9</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>2.0.9.4</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>UIRequiresFullScreen</key>
<true/>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>armv7</string>
</array>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
</array>
<key>CFBundleSupportedPlatforms</key>
<array>
<string>iPhoneOS</string>
</array>
<key>NSCalendarsUsageDescription</key>
<string>my app needs access to the calendar to create new entries</string>
<key>Minimum </key>
<string></string>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSExceptionDomains</key>
<dict>
<key>localhost</key>
<dict>
<key>NSExceptionAllowsInsecureHTTPLoads</key>
<true/>
<key>NSIncludesSubdomains</key>
<true/>
</dict>
<key>%ip%</key>
<dict>
<key>NSExceptionAllowsInsecureHTTPLoads</key>
<true/>
<key>NSIncludesSubdomains</key>
<true/>
</dict>
</dict>
</dict>
</dict>
</plist>