我创建了一个类,我试图访问公共方法内部的一些属性,但我不能,编译器不允许,我真的需要一些帮帮我。 这是我的代码,我指望你们。 是否有其他方法可以做到这一点?如何访问公共方法目标中的属性c
.h文件
@interface DirController : NSObject
+ (void)startCreate;
+(DirController *)getInstace;
@property (strong, nonatomic) NSString * nomeDiretorio;
@property (strong, nonatomic) NSString * enderecoUrl;
@property (strong, nonatomic) NSString * nomeUsuario;
@property (strong, nonatomic) NSString * senha;
//@property (strong, nonatomic) NSString * nomeCliente;
@property (nonatomic, assign, readonly) BOOL isCreating;
@property (nonatomic, strong, readwrite) NSOutputStream * networkStream;
.m文件
+ (void)startCreate
{
BOOL success;
NSURL * url;
// assert(self.networkStream == nil); // don't tap create twice in a row!
// First get and check the URL.
url = [[NetworkManager sharedInstance] smartURLForString:self.enderecoUrl];
success = (url != nil);
if (success) {
url = CFBridgingRelease(
CFURLCreateCopyAppendingPathComponent(NULL, (__bridge CFURLRef) url, (__bridge CFStringRef) self.nomeDiretorio, true)
);
success = (url != nil);
}
// If the URL is bogus, let the user know. Otherwise kick off the connection.
if (! success) {
} else {
self.networkStream = CFBridgingRelease(
CFWriteStreamCreateWithFTPURL(NULL, (__bridge CFURLRef) url)
);
assert(self.networkStream != nil);
if ([self.nomeUsuario length] != 0) {
success = [self.networkStream setProperty:self.nomeUsuario forKey:(id)kCFStreamPropertyFTPUserName];
assert(success);
success = [self.networkStream setProperty:self.senha forKey:(id)kCFStreamPropertyFTPPassword];
assert(success);
}
self.networkStream.delegate = self;
[self.networkStream scheduleInRunLoop:[NSRunLoop currentRunLoop] forMode:NSDefaultRunLoopMode];
[self.networkStream open];
// Tell the UI we're creating.
[self createDidStart];
}
}