1
我解析它看起來像這樣的XML文件:RaptureXML迭代:usingBlock預警和防撞
<partie numero="1">
<exercice numero="1" libelle="blabla"></exercice>
<exercice numero="2" libelle="anything"></exercice>
</partie>
我使用的狂喜XML庫,從而在GitHub上解釋,我執行以下操作:
RXMLElement *rxmlPartie = [rxmlParties child:@"partie"];
NSArray *rxmlUnExercice = [rxmlPartie children:@"exercice"];
我能正確地從partie這一行打印「NUMERO」屬性:
NSLog(@"Partie #%@",[rxmlPartie attribute:@"numero"]);
但是當我嘗試使用伊特在我的NSArray率的方法:
[rxmlPartie iterate:@"partie.exercice" usingBlock: ^(RXMLElement *exercice) {NSLog(@"Exercice: %@ (#%@)", [exercice attribute:@"libelle"], [exercice attribute:@"numero"]);}];
我得到一個警告,該應用程序崩潰,他說:
-[RXMLElement iterate:usingBlock:]: unrecognized selector sent to instance 0xc67f870
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '- [RXMLElement iterate:usingBlock:]: unrecognized selector sent to instance 0xc67f870'
難道我忘了進口的東西,或者我實現該方法在一個糟糕的方式?
,如果我嘗試使用iterateWithRootXPath同樣的錯誤發生...
感謝您的幫助!
我找不到'[rxmlPartie迭代:@「exercice」:^(RXMLElement * exercice)'這個api。 – jianpx