错误:未找到 CocoaPods。请从https://cocoapods.org/安装 1.0.1 或更高版本
我知道这是解决方案
ionic cordova plugin remove phonegap-plugin-push
sudo gem install cocoapods
Run Code Online (Sandbox Code Playgroud)
然后你需要同步cocoapods repo
pod setup
Run Code Online (Sandbox Code Playgroud)
这可能需要一段时间 最后安装推送
ionic plugin add phonegap-plugin-push --variable SENDER_ID="XXXXXXX"
Run Code Online (Sandbox Code Playgroud)
我的操作系统是 MAC
但它仍然无法正常工作。
我一直在尝试使用 Ionic 3 提供的 ionic-native 插件。当我阅读安装说明时,总是有 2 个命令行而不是一个。
ionic cordova plugin add cordova-plugin-camera
npm install --save @ionic-native/camera
Run Code Online (Sandbox Code Playgroud)
如果我没记错的话,ionic plugin add somepluginhere在过去,只有一个类似于 的命令就可以完成工作。
这里有什么区别?
我正在使用 FileChooser 从我的手机和文件插件的内部存储中选择一个文件以将其转换为 base64 但 this.file.readAsDataUrl 给出错误“ FileError{code:2, Message:SECURITY_ERR} ”
我拥有所有必需的权限,但问题仍然存在,下面是我的代码
let base=this
if(this.platform.is('android')){
this.fileChooser.open()
.then(uri => {
var array = uri.split("/");
var path=uri.substring(0, uri.lastIndexOf("/") + 1);
console.log("path"+path)
base.file.readAsDataURL(path, uri).then(dataText=>{
console.log(dataText)
var data = dataText;
},(error)=>{
console.log(error)
})
//console.log(uri)
})
.catch(e => console.log(e));
}
Run Code Online (Sandbox Code Playgroud)
我正在使用 Ionic 3、Angular4、Typescript、Firebase
我正在尝试测试 http 拦截器,但找不到任何方法。
我不知道为什么 url 不匹配,因为我的令牌记录在控制台中并且请求 url 也是相同的。我在没有拦截器的情况下使用这种方法测试了我所有其他的 http 服务,一切都通过了......
这是拦截器类,代码工作并在每个请求中添加我的不记名令牌,它使用在测试中模拟的 Ionic Platform 本机类:
@Injectable()
export class AddHeaderInterceptor implements HttpInterceptor {
public constructor(
private auth: AuthService, private platform: Platform,
private config: ConfigurationService
) {}
public intercept(req: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>> {
console.debug('req', req.url);
return Observable.fromPromise(this.platform.ready())
.switchMap(() => Observable.fromPromise(this.auth.getToken()))
.switchMap((tokens: TokenCacheItem[]) => {
const baseUrl = new RegExp(this.config.getValue('baseUrl'), 'g');
if (! req.url.match(baseUrl)) {
return Observable.of(null);
}
if (tokens.length > 0) {
return Observable.of(tokens[0].accessToken);
}
return Observable.throw(null);
})
.switchMap((token: string) => { …Run Code Online (Sandbox Code Playgroud) 我有一个用于填充的数组,我正在使用离子搜索栏,因此用户可以搜索列表中的项目,但问题是当用户退格或删除他们正在搜索的列表时没有回到原来的状态
代码如下:
<ion-searchbar (ionInput)="setFilteredItems()" placeholder="Search"
[(ngModel)]="searchTerm">
</ion-searchbar>
Run Code Online (Sandbox Code Playgroud)
过滤功能:
filterItems(searchTerms){
return this.categories.filter((item)=>{
return item.category_name.toLowerCase().indexOf(searchTerms.toLowerCase())>-1;
})
setFilteredItems(){
this.categories = this.filterItems(this.searchTerm);
}
}
Run Code Online (Sandbox Code Playgroud) 我想将我的<ion-checkbox>与<ion-label>. 所以主要的问题是,如果你点击标签,我必须显示额外的信息,但你不应该激活复选框。只有在单击“复选框图标/复选框方块”时才应激活复选框。
<div>
<ion-list>
<ion-item *ngFor="let list of list">
<ion-label (click)="showAdditionalInformations()">{{list.item.free_text}}</ion-label>
<ion-checkbox *ngIf="list.item.checkbox==true"></ion-checkbox>
</ion-item></ion-list>
</div>
Run Code Online (Sandbox Code Playgroud)
有人能帮我吗?
我像这样使用 Firestore。
用例 1:
contacts$: Observable<ContactDetail[]>;
constructor(){
}
ionViewDidEnter() {
this.contacts$ = this.contactProvider.getSpecificUserContacts(this.authenticationProvider.user.uid).valueChanges();
this.contacts$.pipe(first()).subscribe(res => { },
err => { },
() => { }
);
}
Run Code Online (Sandbox Code Playgroud)
用例 2:
getAllContactCategories() {
this.categories$ = this.categoryProvider.getAllContactCategories().valueChanges();
this.categories$.subscribe(res => {
this.categorySortedList = res;
},
err => { }
);
}
Run Code Online (Sandbox Code Playgroud)
但我从来没有unsubscribed。那我需要这样做吗?否则,会不会导致内存泄漏并耗尽电池使用量?我知道我们不需要unsubscribed角度HTTP服务,因为它是由框架本身自动完成的。那么 Firestore/Angularfire2observables呢?我从未在firestore书籍或文章或类似的东西中看到过这样的模式。
我目前的进展停留在这样的事情上。我需要帮助
我需要 ion-img 中的图片来填充其容器而不会丢失其外观。这是我的 html 代码
<ion-col class='left-content'>
<ion-img [src]='voucher.image'></ion-img>
</ion-col>
Run Code Online (Sandbox Code Playgroud)
这是我的 scss 代码
ion-img {
min-width: 5.7em;
min-height: 5.7em;
border-radius: 0.5em;
@include my-img-shadow();
}
.left-content {
padding-top: 0.8em;
position: absolute;
left: 0.5em;
}
Run Code Online (Sandbox Code Playgroud) Run custom shell script cp check pods manifest.lock
diff: /Podfile.lock: No such file or directory
diff: /Manifest.lock: No such file or directory
error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.
Run Code Online (Sandbox Code Playgroud)
我正在使用ionic 3,我想在ios 中构建我的应用程序,但它产生了上面提到的问题。
我试过
pod install,
pod update,
reinstall of cocoapods,
pod cache clean**,**cocoapods deintergrate**,**restart of my project,
clean and build of my project
Run Code Online (Sandbox Code Playgroud)
没有任何效果,我在 Xcode 中每次构建项目时从构建阶段删除了libpods.a文件,而且我尝试了来自各个站点的许多解决方案,但直到现在我都没有得到解决方案
我已经构建了一个表单,我在其中实现了表单验证,当用户将电子邮件或密码字段留空时,该表单仅显示一条错误消息。它工作正常,但我的问题是我将电子邮件和密码设置为“AbstractControl”而不是“String”,因此当我尝试使用 firebase 对它们进行身份验证时,我收到此错误消息说“AbstractControl 类型的参数不可分配给参数字符串类型”。我相信问题在于我将电子邮件和密码设置为抽象控制与将其设置为字符串。我如何覆盖它并允许通过验证和身份验证?这是我的代码。
HTML
<ion-content padding>
<form [formGroup]="formgroup">
<ion-list>
<ion-item>
<ion-label>Email</ion-label>
<ion-input type="text" formControlName="email" name="email"></ion-input>
</ion-item>
<ion-item *ngIf="email.hasError('required') && email.touched">
<p>*Email is required</p>
</ion-item>
<ion-item>
<ion-label>Password</ion-label>
<ion-input type="password" name="password" formControlName="password"></ion-input>
</ion-item>
<ion-item *ngIf="password.hasError('required') && password.touched">
<p>*password is required</p>
</ion-item>
</ion-list>
<button clear ion-button (click)="login()">Submit</button>
</form>
</ion-content>
Run Code Online (Sandbox Code Playgroud)
TS文件
import { Component } from '@angular/core';
import { IonicPage, NavController, NavParams } from 'ionic-angular';
import { AngularFireAuth } from '@angular/fire/auth';
import { SignupPage } from '../signup/signup';
import { Validators, FormBuilder, FormGroup, AbstractControl …Run Code Online (Sandbox Code Playgroud) ionic3 ×10
angular ×6
ionic2 ×3
ionic-native ×2
typescript ×2
angularfire2 ×1
cocoapods ×1
firebase ×1
html ×1
ion-checkbox ×1
ios ×1
npm ×1
searchbar ×1
unit-testing ×1
xcode ×1