PYSearch icon indicating copy to clipboard operation
PYSearch copied to clipboard

导入文件夹后无法获取bundle中的资源

Open xinge1 opened this issue 7 years ago • 1 comments

导入文件夹后无法获取bundle中的资源,用cocoapods可以获取到

xinge1 avatar Nov 07 '17 09:11 xinge1

请参考下面的获取资源路径的方式

        //Default use `[NSBundle mainBundle]`.
        searchBundle = [NSBundle bundleWithPath:[[NSBundle mainBundle] pathForResource:@"PYSearch" ofType:@"bundle"]];
        /**
         If you use pod import and configure `use_frameworks` in Podfile, [NSBundle mainBundle] does not load the `PYSearch.fundle` resource file in `PYSearch.framework`. 
         */
        if (nil == searchBundle) { // Empty description resource file in `PYSearch.framework`.
            searchBundle = [NSBundle bundleWithPath:[[NSBundle bundleForClass:[PYSearchViewController class]] pathForResource:@"PYSearch" ofType:@"bundle"]];
        }

ko1o avatar Nov 07 '17 10:11 ko1o