最近一直在做weex的iOS APP禽笑,發(fā)現(xiàn)了不少坑入录,weex自帶的model.toast可以模擬iOS的各種提示框信息,但是實(shí)際應(yīng)用中發(fā)現(xiàn)在網(wǎng)頁(yè)端顯示正常佳镜,但在模擬器和真機(jī)上無(wú)法顯示僚稿,找了很久也沒(méi)發(fā)現(xiàn)有用的信息(weex相關(guān)的資料實(shí)在是太少了!)蟀伸,無(wú)意中發(fā)現(xiàn)了一篇文件完美解決這個(gè)問(wèn)題蚀同。
方法一:如果App沒(méi)有使用storyboard布局,可以刪除Main.storyboard
首先刪除Main.storyboard(有潔癖的肯定也會(huì)刪除Xcode自動(dòng)創(chuàng)建的ViewController)啊掏,記住是移到廢紙簍蠢络,而不是刪除索引
然后刪除Info.plist中的選項(xiàng):Main storyboard file base name即可
方法二:修改WXModalUIModule.m中的方法如下即可:
- (void)toast:(NSString *)message duration:(double)duration
{
WXAssertMainThread();
UIView *superView = [[[UIApplication sharedApplication] windows] objectAtIndex:0];
if (!superView || superView.hidden) {
superView = [UIApplication sharedApplication].keyWindow;
}
if (!superView || superView.hidden) {
superView = self.weexInstance.rootView;
}
UIView *toastView = [self toastViewForMessage:message superView:superView];
WXToastInfo *info = [WXToastInfo new];
info.toastView = toastView;
info.superView = superView;
info.duration = duration;
[[WXToastManager sharedManager].toastQueue addObject:info];
if (![WXToastManager sharedManager].toastingView) {
[self showToast:toastView superView:superView duration:duration];
}
}