當我使用NSString stringWithFormat構造一個動態URL,然後在我的XML解析器中使用該值時,我得到隨機崩潰。但是,如果我有一個字符串常量,它工作正常...NSString stringWithFormat導致iPhone應用程序崩潰
這是我生成的字符串代碼,
loginURL = [NSString stringWithFormat:@"%@%@",ScriptURLString,@"authenticate"];
導致,
http://edms.digistorm.com.au/test/index.php?s=&sc=D41D8CD98F00B204E9800998ECF8427E&m=authenticate
然後我用它測試在我的XML解析器中,
XMLReturnData = [[NSMutableArray alloc] init];
xml = [[XMLParser alloc]
initWithXMLPath:loginURL
lookForElement:@"Authenticate"
setCallbackObject:self
withSelector:@selector(dataReady)
data:XMLReturnData
];
由於某些原因,這導致我的應用程序崩潰。如果我使用一個字符串常量一樣,
loginURL = @"http://edms.digistorm.com.au/test/index.php?s=&sc=D41D8CD98F00B204E9800998ECF8427E&m=authenticate";
它工作正常...
loginURL被定義爲的NSString * loginURL;在這個視圖的頭文件裏面。
任何幫助或指導將不勝感激!
感謝, 添
你能給我們提供的錯誤嗎?如果可能的話,從控制檯複製堆棧跟蹤。 – rckoenes 2011-04-11 07:57:36
任何控制檯消息? – Alkimake 2011-04-11 07:57:47