首页 > 解决方案 > Objective-C 代码中的解析错误

问题描述

我在第 10 行收到 2 个错误:

期望一个类型

预期的 ; 方法原型之后

在编译我的应用程序时。

显示错误的文件NSBundle+NYTPhotoViewer.m具有以下代码 -

代码

#import "NSBundle+NYTPhotoViewer.h"
#import "NYTPhotosViewController.h"      // This is line 10

@implementation NSBundle (NYTPhotoViewer)

+ (instancetype)nyt_photoViewerResourceBundle {
    static NSBundle *resourceBundle = nil;
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        NSString *resourceBundlePath = [[NSBundle bundleForClass:[NYTPhotosViewController class]] pathForResource:@"NYTPhotoViewer" ofType:@"bundle"];
        resourceBundle = [self bundleWithPath:resourceBundlePath];
    });
    return resourceBundle;
}

@end

标签: objective-c

解决方案


推荐阅读