- Joined
- May 27, 2012
- Messages
- 5
- Reaction score
- 0
- Points
- 1
I am doing some exercise on the code sample CTPageViewer, I am really puzzled for release function. Take the follow code for an example:
Why the release message does not send to objects such as filePath, docDict and versionArr. And when should I send release message to an object?
I am studying iOS programming in recent weeks, so please forgive me for the simple question.
Code:
- (void)loadWithFileName {
// .......... some codes
NSString* filePath = [self filePathForFileName:fileName];
if (filePath == NULL) {
NSLog(@"%@ could not be opened/found", fileName);
return;
}
// Get document dictionary
NSDictionary* docDict = [NSDictionary dictionaryWithContentsOfFile:filePath];
if (docDict == NULL) {
NSLog(@"%@ contents cannot be processed", filePath);
return;
}
// Check that document version info is supported
NSArray* versionArr = [docDict objectForKey:ASD_VERSION];
if (![AttributedStringDoc versionIsValid:versionArr] || ![AttributedStringDoc contentIsValid:versionArr]) {
NSLog(@"%@ could not be opened due to version/content(%@) incompatibility", filePath, versionArr);
return;
}
// .......... some codes deleted
}
Why the release message does not send to objects such as filePath, docDict and versionArr. And when should I send release message to an object?
I am studying iOS programming in recent weeks, so please forgive me for the simple question.