Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/120.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
卸载ios 7中下载的字体问题_Ios_Objective C_Ios7_Fonts_Download - Fatal编程技术网

卸载ios 7中下载的字体问题

卸载ios 7中下载的字体问题,ios,objective-c,ios7,fonts,download,Ios,Objective C,Ios7,Fonts,Download,我正在尝试使用服务器提供的字体。 由于这种字体有时会被更新,所以我需要能够加载字体、卸载字体以及加载新版本的字体 在iOS 6中,所有这些都可以正常工作,但在iOS 7中,以下代码的“卸载字体”部分出现问题 NSString* path = @"the path to my font file"; NSURL* url = [NSURL fileURLWithPath:path]; CGDataProviderRef fontDataProvider = CGDataPr

我正在尝试使用服务器提供的字体。
由于这种字体有时会被更新,所以我需要能够加载字体、卸载字体以及加载新版本的字体

在iOS 6中,所有这些都可以正常工作,但在iOS 7中,以下代码的“卸载字体”部分出现问题

    NSString* path = @"the path to my font file";
    NSURL* url = [NSURL fileURLWithPath:path];
    CGDataProviderRef fontDataProvider = CGDataProviderCreateWithURL((__bridge CFURLRef)url);
    CGFontRef fontRef = CGFontCreateWithDataProvider(fontDataProvider);
    NSString * newFontName = (__bridge NSString *)CGFontCopyPostScriptName(fontRef);
    CGDataProviderRelease(fontDataProvider);
    CFErrorRef registeringError = nil;

    NSLog(@"Before registering : %@",[UIFont fontWithName:newFontName size:10]);
    bool registeringSuccess = CTFontManagerRegisterGraphicsFont(fontRef, &registeringError);

    NSLog(@"Before unregistering : %@",[UIFont fontWithName:newFontName size:10]);

    CFErrorRef deletionError = nil;
    bool unregisteringSuccess = CTFontManagerUnregisterGraphicsFont(fontRef, &deletionError);
    CGFontRelease(fontRef);
    NSLog(@"After unregistering : %@",[UIFont fontWithName:newFontName size:10]);
打印日志: 创建前:(空)(这是确定的) 删除前:字体系列:“我的字体名称”;字体大小:正常;字体风格:普通;字体大小:10.00pt(可以) 删除后:字体系列:“我的字体名称”;字体大小:正常;字体风格:普通;字体大小:10.00pt(这不正常,字体仍然可以通过“UIFont fontWithName”方法访问

registeringSuccess和UnregistingSuccess均为true
registeringError和deletionError均为零