File tree Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -166,6 +166,8 @@ - (id)initWithData:(NSData *)data error:(NSError **)outError {
166
166
[self release ];
167
167
return nil ;
168
168
}
169
+ else if (outError)
170
+ *outError = nil ;
169
171
}
170
172
return self;
171
173
}
Original file line number Diff line number Diff line change @@ -10,8 +10,15 @@ - (void) applicationDidFinishLaunching:(UIApplication *)application {
10
10
NSData *data = [NSData dataWithContentsOfFile: sampleXML];
11
11
12
12
// create a new SMXMLDocument with the contents of sample.xml
13
- SMXMLDocument *document = [SMXMLDocument documentWithData: data error: NULL ];
13
+ NSError *error;
14
+ SMXMLDocument *document = [SMXMLDocument documentWithData: data error: &error];
14
15
16
+ // check for errors
17
+ if (error) {
18
+ NSLog (@" Error while parsing the document: %@ " , error);
19
+ return ;
20
+ }
21
+
15
22
// demonstrate -description of document/element classes
16
23
NSLog (@" Document:\n %@ " , document);
17
24
You can’t perform that action at this time.
0 commit comments