12

enter image description hereWhen I tried to put a third-party framework(installed by carthage) in the embedded binaries, I got such an option. I got confused, since "Embedded binaries are binary files that are copied to your application bundle when you build the project", It is already a copy instead of a link, why do I want a copy of a copy?

dennism
  • 513
  • 5
  • 16
den330
  • 387
  • 1
  • 3
  • 15

3 Answers3

18

"Copy items if needed" has nothing to do with the building of your app. It means copied into the project folder, right now (if it isn't in the project folder already). I suggest you always say yes, because otherwise your project might end up depending upon stuff that isn't in the project folder, and which you might therefore throw away or rename by accident, thus causing your project to break.

matt
  • 515,959
  • 87
  • 875
  • 1,141
  • 1
    Not sure why [here](https://youtu.be/tVmG7Ft_ALQ?t=987) this Fabric/crashlytics developer from Twitter recommends against it though. She says it will create "unwanted trouble" – mfaani Jan 29 '18 at 16:14
1

Like matt has said, I recommend you always leave it selected as well. I have had troubles uploading the app, even though I know I have not moved or renamed the file. Also an extra benefit of leaving it enabled is that it makes it easier to share the project with others without having to track down the files not in the project folder.

I can see two cases why leaving it off might be convenient:

  1. You have multiple projects which share the same file and want to reduce space,
  2. You desperately need to save the space on your computer, in which case I would buy extra storage for your computer.

Edit: Even though you copied the file in, XCode treats it as a link to the file, this is why you are seeing this message.

JordanWx
  • 112
  • 1
  • 11
0

Xcode Copy items if needed

Copy items if needed usually (but not always, e.g. the project already contains this item) copies files into your project directory as a result you can use relative path(instead of absolute) safely. For example when you use some version control(Git, SVN...) your team members will not have some troubles with solving issues with paths

In case of third-party framework you can use $(PROJECT_DIR) in Build Settings -> Framework Search Paths

*Also do not forget additionally set dependency if not dyld: Library not loaded[About]

[Create groups vs Create folder reference]

yoAlex5
  • 29,217
  • 8
  • 193
  • 205