簡體   English   中英

當我按注冊按鈕時,我的應用程序崩潰了,但數據已成功插入數據庫中

[英]When I press register button my app has crashed but data insert successfully in database

這是我的回復代碼。

NSString *responseString = [[NSString alloc] initWithData:responseData encoding:NSUTF8StringEncoding];

NSDictionary *LoginResult = (NSDictionary*)[responseString JSONValue];

NSLog(@"Success");

NSMutableArray *wholeJsonArray = [LoginResult objectForKey:@"Response"];

for(NSDictionary *countname in wholeJsonArray)
{

    NSString *countryName = [countname objectForKey:@"country_name"];
    if(countryName)
        [countryArray addObject:countryName];
    NSString *stateName=[countname objectForKey:@"state_name"];
    if(stateName)
        [stateArray addObject:stateName];
}

上面的代碼檢索到國家名稱和州名。

當我在按下按鈕后調試我的代碼時,應用應在NSString *countryName = [countname objectForKey:@"country_name"];崩潰NSString *countryName = [countname objectForKey:@"country_name"]; 線光標點。

NSMutableArray *wholeJsonArray不包含NSMutableDictionary ; 它包含NSString 請檢查您的陣列內容。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM