'Convert to latest Swift Syntax' breaks th

2020-07-10 05:47发布

问题:

My project is in objective-c with just one tableviewcontroller in swift. I downloaded the Xcode-beta today which prompted me to 'Convert to latest Swift Syntax'. After I follow the steps it shows me that there are no changes. I do not see any changes in the proj file either but it has errors. Please note that I do not see the errors when I choose not to covert to latest swift syntax - the app builds and runs fine in this case.

Any idea why it is breaking?

Here are the errors -

  • cannot parse the debug map for "app name" No such file or directory
  • clang: error: linker command failed with exit code 1 (use -v to see invocation)
  • the other errors are that it is not able to find the swift file. The swift class was initiated in the objective-c class.

回答1:

Product -> Clean helped in my case.



回答2:

Switch ENABLE_BITCODE to NO in project build settings helped me.



回答3:

I had an issue similar to this, and I fixed it by changing the build phases/ compile sources in the project :

I had added in new sources that needed to be compiled earlier in the project, and after i deleted the files, when I tried to build the project it said it was missing the files that I deleted. After deleting a few of the build phases that appeared as though they were not the default build phases, it worked fine. I found that there were a default of 4 compile sources.

Also, using Ctrl+Shift+K will clean your project, which helped me another time with an error like this.



回答4:

I was having the same issue, and none of the above answers helped. Apparently, my issue was I had an import using a .m file instead of a .h file.

The easy way to find and fix these would be Find > Find in Project... and searching for #import.*m and changing them to the appropriate .h file