Once the project is moved to a different location, the path links to the structure

Please take a look at the picture: enter image description here

It's my project structure:

  • Annex 1 (top)
  • 3 frames (create your own)
  • 1 static library cocoa pods (bottom)

When I cmd + b, all sub-projects will start from the bottom to the top, there are no problems, everything is in order.

  • To link / tie frameworks, I throw the product framework for each subproject / Build Phases / Link Binary With Libraries and / Build Phases / Copy Files.

The problem is this:

  • When I copy / move the project folder to another location (for example, ~ / oldFolder / app to ~ / newFolder / app), a subproject can not find frameworks, it reports the error message "Not Found", I need to rebuild and drop the product scope for links to correct the error.

It's too stupid and difficult to work with other people who can help?

ps: sorry for my bad english.

Add error pic: enter image description here

+5
source share
3 answers

You can use the $ (SRCROOT), if you want to refer to paths relative to the source directory. $ (SRCROOT) will indicate where your project files. apple doc

Example:

if you have a directory of x in the MyApp folder where the file is in your project, then the folder x can be specified as $ (SRCROOT) / x. Enter it on the road section in the "build options" to access your library.

+2
source

All this boils down to is that you can not change the location of already imported frameworks? This is an example with FBSDKCoreKit.framework. If I change the folder location, I would have to change the relative path. Click on the icon icon next to the name and select a new location

enter image description here

+1
source

I'll talk about how to solve this problem on my side:

  • The Framework:
    • set "$ (SRCROOT) /../ build" in the item "The Path to the products for each configuration" to "Build Settings" page;
    • shift + cmd + k, to clean the assembly of frames, then cmd + b restructure;
  • The MyApp
    • add "$ (SRCROOT) /../ build" an element "search path in the frame" to "Build Settings" page;
    • Drag the framework of the framework of the project the product in the "Link Binary With Libraries" on "phases of assembly" page;
    • Drag the framework of the framework of the project the product in the "Copy files" on the page "Build Phase" (you can also add an element of "Copy files" click on the upper left part of the "construction phase" page);

Please note that if you are using another framework for a project, and the structure also refers to another, for example, a sample of which I posted in my question, you also need to perform the steps as described above (Steps Framework and App).


Another problem that you will face if you are also using cocoapods in your project, such as my example: after you have completed all the above steps, the XCode on an error in your project framework, for example:

ld: framework is not found Pods_xxx.framework

clang: error: linker command failed with exit code 1 (use -v to display the call)

"Xxx" should be the name of your project. To fix this, you just need to remove Pods_xxx.framework project / common / related structures and libraries. The error will be restored after the restoration project. Here you can find a part of the problem.

ps: After you have installed the pod, in the General / Related structure and the library will Pods_xxx.framework file, so you need to remove it again, if you run the command "pod install"

0
source

All Articles