Когда я анализирую, чтобы узнать о потенциальной утечке памяти, я получаю «Неправильный декремент подсчета ссылок объект, который не принадлежит в данный момент с помощью вызывающего абонента»:Я получаю «Неправильный декремент ссылочного счета объекта, который не принадлежит на данный момент вызывающим»
- (int)downloadUrlTofolder:(NSString *)url filename:(NSString *)name tryTime:(int)tryTime
{
int result = 0;
GetFtpService *ftpService = [[GetFtpService alloc] initwithUrlandOutPut:url output:name];
//I have delete the code here, but problem is not solved.
[ftpService release]; //the potential problem point to this line
return result;
}
Ниже "initwithUrlandOutPut" метод:
- (id)initwithUrlandOutPut:(NSString *)url output:(NSString *)o
{
if(self = [super init]) {
self.urlInput = url;
self.outPath = o;
self.success = [NSString stringWithString:@"success"];
self.connected = nil;
}
return self;
}
И интерфейс:
@interface GetFtpService : NSObject <NSStreamDelegate>
@property (nonatomic, retain) NSInputStream *networkStream;
@property (nonatomic, copy) NSString *urlInput;
@property (nonatomic, retain) NSInputStream *fileStream;
@property (nonatomic, copy) NSString *outPath;
@property int tryTime;
@property (nonatomic, copy) NSString *success;
@property (nonatomic, copy) NSString *connected;
- (id) initwithUrlandOutPut:(NSString *)url output:(NSString *)o;
Я хочу знать, почему это произошло? и как это исправить?
Вы используете ARC? – sergio