How to add the parent path to RealmSwift.framework in the “Framework Search Paths” section?

蹲街弑〆低调 提交于 2019-12-29 04:56:27

问题


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

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 ver 6.4


回答1:


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

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.)

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

  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

Please see the below image:

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

  1. Click the main app's target in the "TARGETS" section
  2. Click "Build Phases" tab
  3. Click the "+" button in the top-left corner
  4. Select the "New Run Script Phase"

  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"

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



来源:https://stackoverflow.com/questions/31896667/how-to-add-the-parent-path-to-realmswift-framework-in-the-framework-search-path

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!