XCode 合并了一个项目但找不到资源 [英] XCode incorporating a project but resource cannot be found

查看:26
本文介绍了XCode 合并了一个项目但找不到资源的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我之前有一个项目,它包含了 mapbox-ios-sdk.Mapbox-ios-sdk 发生了一些变化,但我也将一些代码嵌入其中.所以我尝试将 Mapbox-ios-sdk 从 origin 合并到我的分支中,经过一番挣扎终于编译完成.但是,我遇到了这个错误:

I have a project which incorporated mapbox-ios-sdk sometime ago. Mapbox-ios-sdk has undergone some changes but I've also hacked some code into it. So I try to merge the Mapbox-ios-sdk from origin into my branch, and after some struggle finally it has compiled. However, I've run into this error:

2012-10-16 19:09:26.466 OfflineSpotty[81420:11f03] *** 由于未捕获的异常NSInternalInconsistencyException"而终止应用程序,原因:无法找到 LoadingTile.png(从框架资源"复制'文件夹)'

图像已正确添加到左侧窗格中.为什么找不到?

The images are properly added in the left pane. Why is it not finding it?

失败的那一行是:RMRequireAsset(@"LoadingTile.png")

我看到它实际上在 NSAssert 上失败了:

I see that it actually fails on an NSAssert:

#define RMRequireAsset(asset) NSAssert([[NSBundle mainBundle] pathForResource:[asset stringByReplacingOccurrencesOfString:[@"." stringByAppendingString:[asset pathExtension]] withString:@""] ofType:[asset pathExtension]], @"无法找到 %@ (从框架 'Resources' 文件夹复制)", 资产);

还有更完整的信息

`* 断言失败 -[RMLoadingTileView initWithFrame:],/Users/t2wu/Documents/Xcode_projects/Open_source/mapbox-ios-sdk/MapView/Map/RMLoadingTileView.m:242012-10-16 20:24:58.456 OfflineSpotty[17713:11f03] * 由于未捕获的异常NSInternalInconsistencyException"而终止应用程序,原因:无法找到 LoadingTile.png(从框架资源"文件夹复制)"'

`* Assertion failure in -[RMLoadingTileView initWithFrame:], /Users/t2wu/Documents/Xcode_projects/Open_source/mapbox-ios-sdk/MapView/Map/RMLoadingTileView.m:24 2012-10-16 20:24:58.456 OfflineSpotty[17713:11f03] * Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Unable to find LoadingTile.png (copy from framework 'Resources' folder)''

推荐答案

我遇到了同样的问题,终于找到了解决方案.

I faced that same problem and finally found a solution for it.

mapbox ios sdk 项目中有一个名为 MapBox.bundle 的文件,如下图所示:

There is a file called MapBox.bundle inside the mapbox ios sdk project, as seen in the following image:

我所要做的就是在我的主要项目目标中添加 MapBox.bundle(我只是使用拖放).

All I had to do was to add in my main project target (I guess you'll have to add it to OfflineSpotty target) that MapBox.bundle (I just used drag and drop).

之后,项目构建并运行正常.

After that, the project builds and runs ok.

这篇关于XCode 合并了一个项目但找不到资源的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆