【发布时间】:2014-01-20 15:58:14
【问题描述】:
我对 IOS 还很陌生,我现在正在从事这个需要从存储通道(如 Dropbox 和 googleDrive)访问文件的大型项目...
我设法访问了保管箱文件并对其进行了操作,但问题是如果没有视图类上的 DBResClient 属性(在我的情况下为UITableView),我无法做到这一点,这不是 MVC。
当我尝试在另一个类上使用它时,比如实现 DBRESTClientDelegate 的 NSObject,什么都没有发生。
我知道这个问题之前已经发布过,有人说NSObject 需要对其进行强引用,以便它不会被释放,但我这样做了,仍然没有任何反应。
这是我的一些代码:
NSObject 类 DropboxServices
@interface DropboxServices : NSObject <DBRestClientDelegate>
@property (nonatomic, readonly) DBRestClient *restClient;
@implementation DropboxServices
@synthesize restClient=_restClient;
- (DBRestClient *)restClient {
if (!_restClient) {
if ( [[DBSession sharedSession].userIds count] ) {
_restClient = [[DBRestClient alloc] initWithSession:[DBSession sharedSession]];
_restClient.delegate = self;
}
}
return _restClient;
}
- (void)restClient:(DBRestClient *)client loadedMetadata:(DBMetadata *)metadata {
NSLog(@"method called!!!!!!!!!!!!!!!!!!!");
}
这是我曾经拥有 DBRESTClient 的 UITableView 类:
@interface DropboxFolderItemsTableView : UITableView
@property (nonatomic, readonly) DropboxServices *dropboxServices;
但是当我尝试加载元数据时:
[[self.dropboxFolderItemsTableView.dropboxServices restClient] loadMetadata:@"/"];
什么都没有发生。
【问题讨论】:
标签: ios objective-c dropbox