我正在打开.xcworkspace我的Ionic 3项目并尝试在我的设备上运行它,但我突然在Xcode中收到以下错误:
Ld /Users/manuel/Library/Developer/Xcode/DerivedData/MyApp-awaxbzztsgokklgptpuoufwcwmkt/Build/Products/Debug-iphoneos/MyApp.app/MyApp normal arm64
cd /Users/manuel/Documents/MyApp/dev/copernic4-ion2/galilei/platforms/ios
export IPHONEOS_DEPLOYMENT_TARGET=9.0
export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch arm64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS10.3.sdk -L/Users/manuel/Library/Developer/Xcode/DerivedData/MyApp-awaxbzztsgokklgptpuoufwcwmkt/Build/Products/Debug-iphoneos -L/Users/manuel/Documents/MyApp/dev/copernic4-ion2/galilei/platforms/ios/MyApp/Plugins/cordova-plugin-google-analytics -F/Users/manuel/Library/Developer/Xcode/DerivedData/MyApp-awaxbzztsgokklgptpuoufwcwmkt/Build/Products/Debug-iphoneos -F/Users/manuel/Documents/MyApp/dev/copernic4-ion2/galilei/platforms/ios/Pods/OneSignal/iOS_SDK/OneSignalSDK/Framework -FMyApp/Plugins/com.googlemaps.ios -filelist /Users/manuel/Library/Developer/Xcode/DerivedData/MyApp-awaxbzztsgokklgptpuoufwcwmkt/Build/Intermediates/MyApp.build/Debug-iphoneos/MyApp.build/Objects-normal/arm64/MyApp.LinkFileList -Xlinker -rpath -Xlinker @executable_path/Frameworks -miphoneos-version-min=9.0 -dead_strip -Xlinker -object_path_lto -Xlinker /Users/manuel/Library/Developer/Xcode/DerivedData/MyApp-awaxbzztsgokklgptpuoufwcwmkt/Build/Intermediates/MyApp.build/Debug-iphoneos/MyApp.build/Objects-normal/arm64/MyApp_lto.o -Xlinker -no_deduplicate -fobjc-arc -fobjc-link-runtime -ObjC -ObjC -framework OneSignal -framework SystemConfiguration -framework UIKit -framework UserNotifications /Users/manuel/Library/Developer/Xcode/DerivedData/MyApp-awaxbzztsgokklgptpuoufwcwmkt/Build/Products/Debug-iphoneos/libCordova.a -framework Accelerate -framework CoreData -framework CoreLocation -framework CoreText -framework GLKit -framework ImageIO -lc++ -lz -framework OpenGLES -framework QuartzCore -framework SystemConfiguration -framework UIKit -framework GoogleMapsBase -framework GoogleMaps -framework GoogleMapsCore -framework …Run Code Online (Sandbox Code Playgroud) 我正在构建一个离子2应用程序,我正在使用以下组件
http://ionicframework.com/docs/components/#alert
import { AlertController } from 'ionic-angular';
export class MyPage {
constructor(public alertCtrl: AlertController) {
}
showAlert() {
let alert = this.alertCtrl.create({
title: 'New Friend!',
subTitle: 'Your friend, Obi wan Kenobi, just accepted your friend request!',
buttons: ['OK']
});
alert.present();
}
}
Run Code Online (Sandbox Code Playgroud)
我怎样才能确保当我在框外点击警报时不会被解雇?
html的
<offline-picks *ngFor="let pick of pickData" [data]="pick"></offline-picks>
Run Code Online (Sandbox Code Playgroud)
.TS
export class OfflineArticlesPage {
private pickData: picksModel[] = [];
constructor(private localCacheService: LocalCacheServiceProvider) {
}
}
Run Code Online (Sandbox Code Playgroud)
当我使用private member如上所示时,它显示下面的错误.我在编辑器上使用Angular Language Service扩展VS code.
[Angular]标识符'pickData'指的是组件的私有成员
希望private members在组件内部使用是不是很好的编程习惯?但作为上述问题的解决方案,如下面对扩展的回购评论.
语言服务将发出这些错误,因为它们在AOT期间会出错.最终,您需要解决这些问题.
我们计划支持AOT中私人和受保护成员的访问,但至少在6.0(明年春天)之前不会降落.
那么你能告诉我在组件上声明成员的最佳方法是什么?
更新:
我使用ionic cordova run android --prod --deviceCLI命令和最新的Ionic "ionic-angular": "3.5.3",.但它在我的Android设备上运行良好.这意味着它工作得很好,AOT太没了?那为什么会出现这个错误(或实际警告)?
嗨我有一个功能,它会在http请求到服务器后更新.似乎console.log显示该值已更新但UI未更新,除非我单击任何其他组件(例如输入).
这是我的功能:
fileTransfer.upload(this.created_image, upload_url, options)
.then((data) => {
console.log("success:"+data.response); //This is showing correct response
var obj = JSON.parse(data.response);
this.sv_value = obj.value;
console.log(this.sv_value); //This is showing correct value
}, (err) => {
console.log("failure:");
})
Run Code Online (Sandbox Code Playgroud)
这是我的观点html:
<ion-row>
<ion-col center width-100 no-padding>
<h2>{{sv_value}}</h2> //This is not updated
</ion-col>
</ion-row>
Run Code Online (Sandbox Code Playgroud)
有什么办法可以解决这个问题吗?谢谢
更新到IOS 11后,命令
离子cordova运行ios -lc --target ="iPhone-6"
我有错误
**建立成功**
没有为"iPhone 6"找到可用的运行时.[错误]运行cordova run ios时发生错误 - 目标iPhone-6(退出代码1).
模拟器在命令后列出
ios-sim showdevicetypes
Apple-TV-1080p, tvOS 11.0
Apple-TV-4K-4K, tvOS 11.0
Apple-TV-4K-1080p, tvOS 11.0
Apple-Watch-38mm, watchOS 4.0
Apple-Watch-42mm, watchOS 4.0
Apple-Watch-Series-2-38mm, watchOS 4.0
Apple-Watch-Series-2-42mm, watchOS 4.0
Apple-Watch-Series-3-38mm, watchOS 4.0
Apple-Watch-Series-3-42mm, watchOS 4.0
iPhone-5s, 11.0
iPhone-6, 11.0
iPhone-6-Plus, 11.0
iPhone-6s, 11.0
iPhone-6s-Plus, 11.0
iPhone-7, 11.0
iPhone-7-Plus, 11.0
iPhone-SE, 11.0
iPhone-8, 11.0
iPhone-8-Plus, 11.0
iPhone-X, 11.0
iPad-Air, 11.0
iPad-Air-2, 11.0
iPad--5th-generation-, 11.0
iPad-Pro--9-7-inch-, 11.0
iPad-Pro, 11.0
iPad-Pro--12-9-inch---2nd-generation-, 11.0
iPad-Pro--10-5-inch-, 11.0 …Run Code Online (Sandbox Code Playgroud) 我刚刚升级到Ionic 3.0.1所以我可以使用LazyLoading,因为我不能使用我的自定义Pipes:
import { Pipe, PipeTransform } from '@angular/core';
@Pipe({
name: 'StripHTML'
})
export class StripHTML implements PipeTransform {
transform(value, args) {
let striped = value.replace(/(<([^>]+)>)/g, "");
if (args != null) {
if (args.split != null) {
striped = striped.split(args.split);
if (args.index != null) {
striped = striped[args.index];
}
}
}
return striped;
}
}
Run Code Online (Sandbox Code Playgroud)
并在app.module.ts我已将其添加到声明中:
@NgModule({
declarations: [
........,
StripHTML
],
...
Run Code Online (Sandbox Code Playgroud)
现在当我试图在html模板中使用它时出错:
core.es5.js:1085 ERROR Error: Uncaught (in promise): …Run Code Online (Sandbox Code Playgroud) 我的Ionic 2应用程序中有这个网格.是否有任何特定于离子的属性使按钮显示在列(行)的右侧?
<ion-grid>
<ion-row>
<ion-col>col 1</ion-col>
<ion-col>col 2</ion-col>
</ion-row>
<ion-row>
<ion-col>
<button ion-button>My button</button>
</ion-col>
</ion-row>
</ion-grid>
Run Code Online (Sandbox Code Playgroud) 我想从全日历包中导入.css .
首先,我创建了一个新组件my-calendar(html,scss,ts).
然后,我尝试了3种不同的方式,但只有最后一种方式适合我:
如文档所示,在index.html中直接引用该文件(它不起作用,因为在构建项目时对node_modules的引用会丢失)
<link href="node_modules/fullcalendar/dist/fullcalendar.min.css" rel="stylesheet">
添加@import "~fullcalendar/dist/fullcalendar.min.css";在我-calendar.scss.如果我没有错,这应该 在构建项目时将样式添加到main.css中(不起作用)
创建自定义副本配置(copy.config.js)
module.exports = {
...
copyFullCalendar: {
src: ['{{ROOT}}/node_modules/fullcalendar/dist/fullcalendar.min.css'],
dest: '{{BUILD}}'
}
}
Run Code Online (Sandbox Code Playgroud)
并添加@import "fullcalendar.min.css"; 进入my-calendar.scss
更新:
并添加@import "fullcalendar";到my-calendar.scss
以避免编译器错误时使用离子构建--aot --minifycss --minifyjs
如果有人能澄清最好的方法并解释我是否误解了某些概念,我将不胜感激.
PS:请记住我正在使用Ionic3而我没有使用Angular CLI.
Witout
from选项PostCSS可能会生成错误的源映射或找不到Browserslist配置.将其设置为CSS文件路径或undefined以防止此警告
ionic3项目,当我运行时向我ionic corodva bulid ios --prod显示此警告.
离子信息
cli packages: (/usr/local/lib/node_modules)
@ionic/cli-utils : 1.19.0
ionic (Ionic CLI) : 3.19.0
global packages:
cordova (Cordova CLI) : 7.1.0
local packages:
@ionic/app-scripts : 3.1.7
Cordova Platforms : android 6.3.0 ios 4.4.0
Ionic Framework : ionic-angular 3.9.2
System:
ios-deploy : 1.9.2
Node : v6.11.3
npm : 3.10.10
OS : macOS Sierra
Xcode : Xcode 9.2 Build version 9C40b
Environment Variables:
ANDROID_HOME : not set
Misc:
backend : pro
Run Code Online (Sandbox Code Playgroud)
更新: …
我在Ionic v3中扩展了默认的web pack配置,用于强制缓存破坏程序.我能够指纹生成的javascript工件,但无法在assets文件夹下指纹图像和JSON文件.我从中获取帮助 Bundled files and cache busting.
摘录 webpack config.js
module.exports = {
// ...
output: {
filename: '[name].[chunkhash].js',
chunkFilename: '[name].[chunkhash].js',
},
plugins: [
new WebpackChunkHash({algorithm: 'md5'}) // 'md5' is default value
]
}
Run Code Online (Sandbox Code Playgroud)
以上是指纹识别javascript包的方法,它工作正常我想在资产文件夹中添加哈希/指纹图像和JSON文件我也使用相同的方法处理图像,但它不起作用.我扩展了webpack config.js并添加了一个新的图像规则.默认情况下,webpack直接将图像和资源复制到输出文件夹.
复制Config.js
module.exports = {
copyAssets: {
src: ['{{SRC}}/assets/**/*'],
dest: '{{WWW}}/assets'
},
copyIndexContent: {
src: ['{{SRC}}/index.html', '{{SRC}}/manifest.json', '{{SRC}}/service-worker.js'],
dest: '{{WWW}}'
},
copyFonts: {
src: ['{{ROOT}}/node_modules/ionicons/dist/fonts/**/*', '{{ROOT}}/node_modules/ionic-angular/fonts/**/*'],
dest: '{{WWW}}/assets/fonts'
},
Run Code Online (Sandbox Code Playgroud)
这里的图像和其他资产都是直接复制的.我在扩展的webpack.config.js中添加了一条新规则,但构建过程忽略了它.如何解决这个问题?
摘录 webpack config.js
{
test: /\.(png|jpg|gif)$/,
loader: 'file-loader',
options: {
name:'[name].[hash].[ext]',//adding hash for …Run Code Online (Sandbox Code Playgroud)