7

While compiling the application getting as following error

" compiled with older version of Swift language (3.0) than previous files (4.0) file "

Could you please help me?

sunilkumar
  • 179
  • 1
  • 2
  • 10

8 Answers8

18

Use the xcworkspace to build instead of the xcproject?

This usually happens when using Cocoapods and you are building from the xcproject which doesn't know about the cocoapod libraries.

Krishna kushwaha
  • 275
  • 2
  • 11
  • How to use the xcworkspace to build can you explain in detail? – Marfin. F Oct 09 '18 at 01:51
  • 1
    just closed xcode than go through your project folder u will get there (yourproject.xcworkspace ) . whenever you add or update library than u need to close xcode . after finished your updates u can open .xcworkspace file – Krishna kushwaha Oct 10 '18 at 04:31
  • @Krishnakushwaha my project folder there is no any .xcworkspace file – Akila Devinda Oct 13 '18 at 20:24
  • @AkilaDevinda ok no problem just go through your project directory and install pod using terminal cmd - pod install after that you will get .xcworkspace – Krishna kushwaha Oct 15 '18 at 04:33
9

Delete the derived data and do a clean build.

And if you are building a framework, make sure you've selected Generic IOS Device while building or set the Build for Active Architecture only as true in Build Settings.

Abhishek Jain
  • 826
  • 8
  • 20
4

I think this happens because you changed your app name or maybe the target

look to solve this problem see your target in Podfile

and then come back to your xcode in the targets select your target app and in linked Frameworks and Libraries (the last one down) see if there's any pods with light color and a strange name than your target in the podfile and remove it using the minus button down .

Ahmed Samir
  • 291
  • 3
  • 6
1

I'd rather fix the specific problem, but if none of the other answers worked a full reset can solve it. If you are getting this error and you are also getting error readouts that refer to "duplicate symbol files", AND all other efforts have failed, then a full reset could work for you.

What worked for me:

  1. Read the error report to identify the repo that supposedly contains duplicate files.
  2. Drag repo to the trash.
  3. re-clone your repo.
  4. set up your repo with correct remote tracking. git remote add <url.git>, or git remote set-url <url.git>

This absolutely worked for me. In my case for some elusive reason, when I ran git pull upstream develop for a local dependency, git would pull in/generate duplicate files from multiple commits.

After following the above steps, the issue went away and git pull upstream develop was no longer pulling from multiple commits at once. Perhaps there was a weird git cache for my repo.

ScottyBlades
  • 12,189
  • 5
  • 77
  • 85
1

I had the two copies of files in the codebase. Deleting one copy helped code to build successfully

garg
  • 2,651
  • 1
  • 24
  • 21
0

I am probably late for you, but for future devs in problems...

If you have been manipulating the podfile or creating new targets or maybe changing the name of any of them, check that in build phases options your just have correct pod framework for the name of the targets.

Alex Delgado
  • 984
  • 11
  • 19
0

if you have pod first clean project and close Xcode then open terminal and go to folder of Project then pod update open the project and run in my case work!

0

I fixed this problem today by running the app in the simulator using the target associated with the bundle file named in the Build Settings-->Bundle Loader setting of the test target. Previously I had deleted my derived data folder while working on a different target that has a different Product Name than the one associated with the test target bundle file. Rerunning the app in the simulator must have recreated the bundle file in the derived data folder that the test target is looking for and then my tests started running fine.

KeithTheBiped
  • 832
  • 10
  • 21