2012-02-19 34 views
0

即時消息使用Asihttprequest爲我的HTTP請求,我的應用程序將漢德3語言:阿拉伯語,法語和英語,但Asihttprequest錯誤localizedDescription返回總是英文說明。 是Asihttprequest請求使用默認的ios系統本地化描述?如果是的話我怎麼能本地化錯誤? 謝謝。Asihttprequest localizedDescription always英文

回答

2

我不確定你到底在問什麼,但你可以試試這個。

在ASIHttpRequest.m文件Initialize方法中使用NSLocalizedString(@"REQUESTTIMEOUT_KEY", @"The request timed out")而不是@"The request timed out"

在相應的localizable.strings文件中有"REQUESTTIMEOUT_KEY" = "EngVersion:The request timed out";

示例代碼:

ASIRequestTimedOutError = [[NSError alloc] initWithDomain:NetworkRequestErrorDomain code:ASIRequestTimedOutErrorType userInfo:[NSDictionary dictionaryWithObjectsAndKeys:NSLocalizedString(@"REQUESTTIMEOUT_KEY", @"The request timed out"),NSLocalizedDescriptionKey,nil]]; 
+0

感謝您重播,我在想,ASIHttpRequest有一個本地化的錯誤消息,但您的解決方案是很大的一個易於使用的,謝謝。 – 2012-04-05 08:45:24