iOS SDK中的NSAlert.h在哪里? [英] Where is NSAlert.h in the iOS SDK?

查看:207
本文介绍了iOS SDK中的NSAlert.h在哪里?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

根据iOS的使用和创建错误对象 ,可以使用以下代码显示错误对象。

According to iOS's Using and Creating Error Objects, one can display a error object with the following code.

NSError *theError = nil;
BOOL success = [myDoc writeToURL:[self docURL] ofType:@"html" error:&theError];

if (success == NO) {
    // Maybe try to determine cause of error and recover first.
    NSAlert *theAlert = [NSAlert alertWithError:theError];
    [theAlert runModal]; // Ignore return value.
}

不幸的是,我不够聪明,无法弄清楚如何包含 NSAlert.h

Unfortunately, I am not smart enough to figure out how to include NSAlert.h.

任何帮助都将不胜感激。

Any help would be appreciated.

推荐答案

该文档指的是(OS X)AppKit框架。在那个方框之后,它说:

That document is referring to the (OS X) AppKit framework. Right after that box, it says:


(UIAlertView,对应于NSAlert的UIKit类,没有alertWithError的等效方法:。)

(UIAlertView, the UIKit class corresponding to NSAlert, has no equivalent method for alertWithError:.)

你仍然可以使用 UIAlertView ,但是你需要手动填充错误的标题,消息和按钮字符串。

You can still use UIAlertView, but you'll need to manually populate the title, message, and button strings from the error.

这篇关于iOS SDK中的NSAlert.h在哪里?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆