0

iOSを使用してアプリケーションでツリーを作成していますCFTree。「宣言されていない識別子 ' CFTree' の使用」というエラーが表示されます。私は何が欠けていますか?私のコード:

#import "ViewController.h"
#import <CoreFoundation/CoreFoundation.h>

@implementation ViewController

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.

    CFTree tree = CreateMyTree(kCFAllocatorDefault);
}

static CFTreeRef CreateMyTree(CFAllocatorRef allocator) {
    NSString *info = @"Bhushan is great";
    CFTreeContext ctx;
    ctx.version = 0;
    ctx.info = (__bridge void *)(info);
    ctx.retain = CFRetain;
    ctx.release = CFRelease;
    ctx.copyDescription = NULL;
    return CFTreeCreate(allocator, &ctx);
}
4

2 に答える 2

0

タイプはCFTreeRefであり、 ではありませんCFTree:

CFTreeRef tree = CreateMyTree(kCFAllocatorDefault);
于 2013-10-23T11:45:38.807 に答える
0

これを試して:

NSString *info;
CFTreeContext ctx;

NSString *treeString = [[NSString alloc] initWithFormat:@"the tree string"];
info = treeString;

ctx.info = (__bridge void *)(info);
CFTreeRef myTree = CFTreeCreate(NULL, &ctx);

これはリンクです:オブジェクト C で CFTree を作成する

于 2013-10-23T11:53:25.013 に答える