ios - Retrieving NSDictionary Objects -


I have this dictionary that is extracted from XML parser. GITUB library has been used to parse XML files with this link.

  quiz = {question = ({"@id" = 1; answer = D; a = "tree"; b = "tree"; c = " Mountain "; d = water; question =" where fish live? "}, {" @id "= 2; answer = d; a =" four "; b =" two "; c =" six "; d = Three; Question = "How many feet for a rabbit?";}, ......};   

I get key question, answer, option 1-4 to recover items I am trying to do something but how can I not go through the value.

 for  (in NSString * key XmlDictionary) {NSDictionary * subDict = [xmlDictionary objectForKey: @ " N "log" (@ "correct answer \ n \ n% @", [sub-object objectForcae: @ "answer"]); // all your other code here.}   

No value is coming back. In fact, I have 10 elements inside that XML and during parsing it shows that I have 10 points I XmlDictionary and this return 1. It is sure what is going wrong here ?

In addition to this, will I remove all values ​​depending on the @ID?

UPDATED:

UPDATED: I Sector in the XML file ... Tags ... turned

  NSDictionary * currentObject; If (rowIndex & lt; countXML) {currentObject = [MuteAirIndexAx: Line Index]; } And {{Self Performance Soft with Identifier: @ "Simple" Sender: Self]; } NSString * questionLbl = [current object objectForKey: @ "question"]; NSString * op1Lbl = [current object objectForcae: @ "A"]; NSString * op2Lbl = [Current Object Objective: @ "B"]; NSString * op3Lbl = [current object objectForcae: @ "c"]; NSString * op4Lbl = [current object objectForcae: @ "D"]; NSString * answer = [current object objectForcae: @ "answer"]; NSString * questNoLbl = [current object objectifier: @ "@ id"]; QuestionID.text = [["Question #" stringBapping string: Search: Noah]; questions. Text = questionLbl; [Answer1 Settital: op1Lbl forState: UIControlStateNormal]; [Answer2 setTitle: op2Lbl forState: UIControlStateNormal]; [Answer3 Settlement: op3laboldoldstate: UIContolstadt normal]; [Answer4 Settimes: op4lbl forState: UIControlStateNormal];   

Now I have a question that there are ways to recover each question and display it in QuizView controller. When the user clicks the button it should be connected to a new controller and it should be displayed whether the answer is correct and after returning the "Continue" button in the ResultViewController, it returns back to the QuizViewController. Now I have all these setups.

Now it is to show that the answer is correct or not in ResultViewController.

with this line

  NSDictionary * subDict = [xmlDictionary objectForKey : @ "questions"];   

You are getting the same dictionary back, you already have it.

Try this:

 For  (NSString * key in xmlDictionary) {NSDictionary * subDict = [xmlDictionary ObjectForreq: key]; NSLog (@ "correct answer \ n \ n% @", [Sub-item for commodity object: @ "answer"]); // all your other code here }   

With your edited XML structure, you should do this:

  NSDictionary * rootDict = [xmlDictionary objectForKey: @ "question"]; (NSString * key for rootDict) {NSDictionary * subDict = [rootDict objectForKey: key]; NSLog (@ "correct answer \ n \ n% @", [Sub-item for commodity object: @ "answer"]); // all your other code here }    

Comments

Popular posts from this blog

excel vba - How to delete Solver(SOLVER.XLAM) code -

github - Teamcity & Git - PR merge builds - anyway to get HEAD commit hash? -

ios - Replace text in UITextView run slowly -