Recently added first swift file to large obj-c project. Compile and run in simulator is fine. Attempt to compile and run for a device and I get a file not found error on the obj-c compiler generated swift header file (aka Objective-C Generated Interface Header Name ending with -swift.h)
I have confirmed (at least to my knowledge) that project settings are correct and can see the file in the (derived data) file system for debug / simulator builds but nothing else.
Have looked at this and this but have not helped. Using xCode8 GM
The problem corrected itself when I
Did a clean (have done many times before)
Built for "Generic" iOS device (success)
Closed and restarted Xcode
Built for Device
go figure..
[Edit] and if this doesn't help .. try this post I just found for more ideas
Related
I get this error only when I try to archive, building for simulator or other test device works. Previously, I had this problem when trying to build for a test device, but I started over and reinstalled the pod and it worked. I have tried setting 'Allow non-modular Includes in Frameworks' to yes in both my project and Target, but this has NOT worked. Any ideas on how to get out of this would be greatly appreciated!
I got the same error (for archiving only) for my Swift framework with C code inside.
Only this remedy helped me.
Add -Xcc -Wno-error=non-modular-include-in-framework-module in Other Swift Flags (build settings of framework). This flag forces the compiller count that error as a warning.
I've upgraded to Xcode 10 and realized that filename completion in #import statements are not working properly. Here is a small part of my project:
Here is what happens when I try to complete a filename:
I've restarted my Mac, cleaned build folders, did all the common "fixes", though nothing changed.
When I type the filename manually, I don't get any errors, everything compiles correctly, and code completion works perfectly too.
What might be wrong? Is there anything that I can do or is Xcode 10 inherently broken?
UPDATE: I'm on Xcode 10.1 and it's still broken.
As "zhysan" pointed out on
https://forums.developer.apple.com/thread/108523
this seems to be caused by the new build system.
This works for me:
File -> Project Settings... -> Build system -> Legacy build system.
I'm running OS 10.11, and my Xcode version is 7.2.
All of the sudden my project fails to compile in Xcode. Xcode seems to be confused about the file type -- I'm getting errors that indicate my code is being compiled as C++ even tho all the files in my project are labeled as type Objective-C code. Here are some of the errors that occur in deeply-nested system header files:
Unknown type name 'namespace' 'utility' file not found (from #include_next <utility>)
I've verified that all the files are listed as Objective-C. I've even tried changing them to Objective-C++, by 'Identity and Type', and by also changing the extensions to .mm, but this introduces an even bigger set of mysterious compile errors deep in system-level header files, such as:
Use of undeclared identifier 'nullptr_t'; did you mean 'nullptr'? No member named 'memchr' in the global namespace
I've tried reinstalling Xcode a couple times. Any suggestions?
Further mystifying is that I have a different Mac with the same version of OS X, same version of Xcode, and with the exact same code (verified thru git), and it compiles fine.
I created a new project, copied all the files and configuration to the new project, and the issue resolved itself.
I have created an iPhone project that uses uses the ZXing bar code scanning library. I added ZXing using CocoaPods and it works perfectly when I compile it on my system (Mountain Lion with Xcode 4.5 (4G182)). But when I passed it on to the person in charge of producing the signed ipa for enterprise distribution, who from what I understand is also using the same version of Xcode, he is seeing the following parse error when compiling:
Parse Issue
Expected unqualified-id in file included from /The/Absolute/Path/to/Pods/ZXing/objc/src/ZXing/ZXBinarizer.mm
The line that is highlighted is:
#import <ZXing/ZXBinarizer.h>
^
I was able to look at his system via WebEx and I checked the header search paths and the values that were apparently configured via CocoaPods do resolve to the actual location of the files.
When I clicked on the "Parse Issue" line in the issue navigator, it showed only:
../../ZXing/objc/src/ZXing/ZXBinarizer.h
^
I've searched the web quite a bit for a solution and I see plenty references to 'Expected unqualified-id', but most of them are due to malformed code.
There are still quite a few things about Xcode that I do not understand, so I'm hoping that someone will tell me that I've overlooked something simple here.
Posting links to the exact code being compiled would help.
You can use clang -E to see what the code looks like after preprocessing (with all the #imports expanded), and then diff the preprocessed output on your system against the output of the same command on your colleague's system.
I do see in
http://code.google.com/p/zxing/source/browse/trunk/objc/src/ZXing/ZXBinarizer.h
that they're referring to NSObject without #importing <Foundation/Foundation.h> first. This is a bad idea, but it's probably not your actual problem. (I would expect a different error message if it were the culprit.)
Are you 100% sure that your colleague is compiling ZXBinarizer.mm as Objective-C++, not as regular C++?
Are you 100% sure that Xcode doesn't give you any specific file and line information for the error? If Xcode really is just pointing to an #import line, then can you post the 10 lines before and after that line, and also the first 10 lines of the file being #imported?
I ended up having to revert out of using CocoaPods for dependency management and just include the project manually. Since the problem was on someone else's machine, but worked fine on my own, I was unable to determine the real cause. After I just included ZXing directly in my project, he was able to compile it.
smcmahon, I've had a very similar issue with building an iOS project with CocoaPods and seeing those weird errors, and was able to figure out the problem. Make sure that the symlinks that CocoaPods has created (like ZXing/ZXBinarizer.h) are indeed symlinks, and not just regular text files with a filepath in them.
A bit more detailed explanation is in my blog: http://www.egeek.me/2013/01/26/note-about-building-cocoapods-powered-ios-projects/
Hope this will help.
Everything's fine building in xcode and testing the app until I built in for archive.
I am capable of running my program in xcode and it does really work.
My problem is that when I tried to archive the project the error come out.
This is the error:
Lexical or Preprocessor Error issue
'TapkuLibrary/TapkuLibrary.h' file not found
Please help!
Do you have different Header search paths for develop/archive/release?