如何在“框架搜索路径"部分中将父路径添加到RealmSwift.framework? [英] How to add the parent path to RealmSwift.framework in the “Framework Search Paths” section?

查看:72
本文介绍了如何在“框架搜索路径"部分中将父路径添加到RealmSwift.framework?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

此步骤在安装Realm的说明中列出.此处链接: https://realm.io/docs/swift/latest/

This is step is listed in the instructions for installing Realm. link here: https://realm.io/docs/swift/latest/

我是xcode的新手,我不知道如何完成此步骤.有人可以给我详细的指示吗?我在构建设置中找到了框架搜索路径"部分,但我什至不知道添加父路径的含义.

I am new to xcode and I don't understand how to complete this step. Can someone give me detailed instructions? I found the Framework Search Paths section in the build settings, but I don't even know what it means to add a parent path.

我还需要有关下一步的帮助,即创建一个新的运行脚本阶段.

I also need help with the next step, creating a new run script phase.

xcode版本6.4

xcode ver 6.4

推荐答案

如果正确地执行了第二步,则项目目录将如下所示:

If you follow to 2nd step correctly, the project directory will be like following:

现在,您可以构建主应用程序的目标了.但是,如果使用Realm执行单元测试,则由于找不到框架而将导致构建失败.因此,您应该确定框架中的位置. (更准确地说,您还应该为应用程序的主要目标设置Framework Search Paths.它是在第2步完成时由Xcode自动设置的.)

Now, you can build main app's target fine. However, if you execute the unit test with Realm, it will be failed to build due to it cannot find the framework. So you should tell where in the framework is. (More precisely, you should also set the Framework Search Paths for the app's primary target. It was set by Xcode automatically when step 2 is done.)

要为单元测试目标设置Framework Search Paths,请执行以下步骤:

To set the Framework Search Paths for the unit test target, do the following steps:

  1. 在Xcode的项目浏览器"中单击项目
  2. 点击目标"部分中的单元测试目标
  3. 点击构建设置"标签
  4. 向下滚动并找到搜索路径"部分
  5. 双击框架搜索路径"的值
  6. 点击弹出式窗口左下角的"+"按钮
  7. $(PROJECT_DIR)添加到文本字段 (父路径"是框架中的位置.框架在项目根目录中以$(PROJECT_DIR)表示.)
  8. 按"enter"键接受文本
  1. Click the project in the "Project Navigator" of Xcode
  2. Click the unit test target in the "TARGETS" section
  3. Click the "Build Settings" tab
  4. Scroll down and find the "Search Paths" section
  5. Double click the value of "Framework Search Paths"
  6. Click "+" button in the bottom-left of popover
  7. Add $(PROJECT_DIR) to text field ("Parent path" is the place where is in the framework. The framework in the project root directory that is represented $(PROJECT_DIR).)
  8. Press "enter" key to accept the text

请参见下图:

现在,您已经完成了步骤3.下面是步骤4:

Now, you have done to the step 3. Step 4 is following:

  1. 在目标"部分中单击主应用程序的目标
  2. 点击构建阶段"标签
  3. 点击左上角的"+"按钮
  4. 选择新运行脚本阶段"

  1. 打开添加的运行脚本"部分
  2. 将以下代码段粘贴到文本字段中 bash "${BUILT_PRODUCTS_DIR}/${FRAMEWORKS_FOLDER_PATH}/Realm.framework/strip-frameworks.sh"
  1. Open "Run Script" section that added
  2. Paste the following snippet to the text field bash "${BUILT_PRODUCTS_DIR}/${FRAMEWORKS_FOLDER_PATH}/Realm.framework/strip-frameworks.sh"

开发不需要步骤4,但是在提交应用程序时,它需要解决App Store提交错误.

The step 4 is not required for development, but it needs to work around an App Store submission bug when you submit the app.

这篇关于如何在“框架搜索路径"部分中将父路径添加到RealmSwift.framework?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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