UCU*_*110 1 iphone objective-c ios4
亲爱的iPhone开发者,我有一个实例方法,意味着返回一个字符串
- (NSString *)newFile:(NSString *)inFile andFileNumber:(NSInteger)aNumber {
return [NSString stringWithFormat:@"%@.o%i",inFile,aNumber];
}
Run Code Online (Sandbox Code Playgroud)
我将此方法称为
outputFileName = [self newFile:inputFileName andFileNumber:newNumber];
// where inputFileName is a string and newNumber is an integer
// outputFileName (also a string), inputFileName and newNumber are declared in
// the interface and in the implementation
Run Code Online (Sandbox Code Playgroud)
当我使用Analyzer编译项目时,它会提供以下消息;
此外,当它尝试释放outputFileName时,应用程序崩溃.有人知道出了什么问题吗?提前致谢.
问题是惯例的假设.具体来说,静态分析器假定任何以start开头的方法都new返回一个保留的对象.这是因为系统API遵循此约定.
重命名你的方法; fileNameWithBase:fileNumber:浮现在脑海中.
| 归档时间: |
|
| 查看次数: |
106 次 |
| 最近记录: |