【发布时间】:2012-08-06 09:57:15
【问题描述】:
我正在尝试使用 ios5 制作应用程序,我真的很困惑为什么会发生这种情况。有人可以帮我解释一下为什么出现&error时会出现错误
将非本地对象的地址传递给__autoreleasing参数以进行回写
以下调用导致错误
// note the following method returns _inStream and _outStream with a retain count that the caller must eventually release
if (![netService getInputStream:&_inStream outputStream:&_outStream]) {
NSLog(@"error in get input and output streams");
return;
}
我的班级.h
NSInputStream *_inStream;
NSOutputStream *_outStream;
@property (nonatomic, strong) NSInputStream *_inStream;
@property (nonatomic, strong) NSOutputStream *_outStream;
我的班级.m
@synthesize _inStream;
@synthesize _outStream;
getInputStream是一个NSNetService类方法
请在下面的NSNetService类getInputStream实现
/* Retrieves streams from the NSNetService instance. The instance's delegate methods are not called. Returns YES if the streams requested are created successfully. Returns NO if or any reason the stream could not be created. If only one stream is desired, pass NULL for the address of the other stream. The streams that are created are not open, and are not scheduled in any run loop for any mode.
*/
- (BOOL)getInputStream:(NSInputStream **)inputStream outputStream:(NSOutputStream **)outputStream;
我在
中找到了相关帖子non-local-object-to-autoreleasing-parameter
non-local-object-to-autoreleasing
from-ios-4-to-ios-5arc-passing-address
但是我找不到问题
感谢您对此问题的任何帮助
谢谢
【问题讨论】:
标签: iphone objective-c automatic-ref-counting