error: libxml/parser.h: No such file or directory - objective-c

I'm attempting to use XML (Chapter 10 in Professional iPhone and iPad Database Application Programming), and I've run into a bit of trouble.
Under Header Search Paths in Build Settings I have this path:
/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.3.sdk/usr/include/libxml2/
That's all fine and well, but then:
#import <libxml/parser.h>
#import <libxml/tree.h>
error: libxml/parser.h: No such file or directory
If I flip the imports:
#import <libxml/tree.h>
#import <libxml/parser.h>
error: libxml/tree.h: No such file or directory
Weird.
For now I have this:
#import <libxml/catalog.h> // Dirty hack
#import <libxml/parser.h>
#import <libxml/tree.h>
error: libxml/catalog.h: No such file or directory
But that's no good for a production app.

Try changing your header search path to ${SDK_DIR}/usr/include/libxml2.

As it turns out, it was a trivial fix. I closed the project to work on another, and when I reopened it, the error was gone. Not exactly what I would have expected, but hey, it works now.
"When in doubt, reboot."

Related

Bridging header issues, Missing header files when run on device

I have following lines on my Bridging-Header.h
//
// Use this file to import your target's public headers that you would like to expose to Swift.
//
#import "FMDB.h"
#import "UAProgressView.h"
#import "ASValuePopUpView.h"
#import "ASValueTrackingSlider.h"
#import "JZMultiChoicesCircleButton.h"
#import "VYPlayIndicator.h"
#import <AVFoundation/AVFoundation.h>
It works great with no errors when I run it on the simulator.
But when I run it on the device, it highlights with error "'FMDB.h' file not found". If you remove the line "for testing purpose" the error goes to the next line and so on.
What could be the problem when I run it on the device????!!!
In Xcode, select your project target, build setting and search for 'objective-c bridging header'. make sure the path equals the path of your bridging header file

umbrella header for module 'myFramework' does not include header 'otherFramework.h'

My Swift / iOS9 framework 'viewer_protocol' uses another and external Objective-C framework (CocoaAsyncSocket). I'm using Carthage to build CocoaAsyncSocket. So far everything works fine: In have an example App inside my framework Xcode Project using my framework without any problems.
Now I want to use my Framework in a different Xcode Project - although using Carthage. I include only my Framework as a dependency and Carthage automatically resolves the dependencies to CocoaAsyncSocket. I embedded both frameworks into this new Xcode Project and build my App: Everything works fine here - except one warning I can't rid off:
/Users/John/Repositories/my_project/<module-includes>:1:1:
Umbrella header for module 'my_project' does not include header 'GCDAsyncSocket.h'
This is my framework header:
#import <UIKit/UIKit.h>
//! Project version number for my_project.
FOUNDATION_EXPORT double my_projectVersionNumber;
//! Project version string for my_project.
FOUNDATION_EXPORT const unsigned char my_projectVersionString[];
// In this header, you should import all the public headers of your framework
using statements like #import <my_project/PublicHeader.h>
#import <CocoaAsyncSocket/CocoaAsyncSocket.h>
As you can see CocoaAsyncSocket.h is imported. Furthermore inside my framework the CocoaAsyncSocket.h file is included:
What I am missing here? I'm using several others external frameworks inside my framework, there're no warnings for them - all of these external frameworks are written in Swift - CocoaAsyncSocket is pure Objective-C.
This is my frameworks module.modulemap:
framework module my_project {
umbrella header "my_project.h"
export *
module * { export * }
}
module viewer_protocol.Swift {
header "my_project-Swift.h"
}
Update
I found a solution: Changing the import statement in my framework header from
#import <CocoaAsyncSocket/CocoaAsyncSocket.h>
to
#import "CocoaAsyncSocket/CocoaAsyncSocket.h"
Now Xcode finds the header file and the warning disappears.
I recently ran into same issue. Apparently I had header file set as public in target membership, but it was not exposed in umbrella header. Fixed issue by making header file with project access instead of public.
I had the same issue. Seemed to be related to old build files.
The standard Xcode problem fixer worked for me:
Clean project (Product > Clean Build Folder)
Deleted derived data
Restart Xcode
I had the same issue today
Umbrella header for module 'HockeySDK' does not include header 'BITHockeyBaseViewController.h'
and the solution was
1.build and run project and go-to Report Navigator
2.look at the warning, click to expand details
it will so you the file name where you need to make change
as you can seen in below screen shot
So i just updated my import statement in AppDelegate.m file
New
#import "HockeySDK/HockeySDK.h"
Old
#import <HockeySDK/HockeySDK.h>
and issue gone..
hope this will help someone. who are coming here for solution.
For me the solution was as follows:
1) Each Objective C framework has 1 header file that contains all the:
#import ...
#import ...
#import ...
2) Make sure that this file imports the missing header.
3) Build the project again, it should remove the warning.
Alternatively, you may have exposed files within the Public area of your framework's build phases that should actually be moved back to the Project area.
If you don't want those files to be within your framework's umbrella header so they're publicly accessible, you can revert this.
Goto Framework -> Target -> Build Phases and drag to move the unnecessary header files from Public to Project.
Just for completeness if your header is set to public in :
Build Phases > Headers
You should either
Include the import in your main header as others have mentioned
OR
Move that header to "private" if it doesn't need to be exposed
We got this recently and it was due to corruption in DerivedData. Deleting that folder fixed the problem.
For others :
In my case I already move the headers I want to expose from my framework, from "project" to "public" (Build phases of the framework target)
Then Xcode gave my this warning.
Xcode is telling us that we also need to add #import "name of header in the warning> in the public header file that was created with framework, so the clients (of the framework) will know this header.
So The Fix:
1.go to the framework public header file.(the one what created by xcode when you created the framework) .
2. add #import "the-name-of-the-header-in-the-warning.h"
In my case (Obj-c framework):
Umbrella header for module 'opus' does not include header 'opus_multistream.h'
I needed to change:
#import opus.opus_defines;
into
#import opus;
(I don't have in #import "....h" or #import <....h> for frameworks)
Take a look at this post:
#import vs #import - iOS 7
It goes over the concepts of the new module importing.
I had my own custom framework and after adopting the new method to import objective-c framework
old:
#import <MyFramework/MyFramework.h>
new:
#import MyFramework;
it took care of the warning/
Deleting DerivedData did the trick for me. Try running the below command and see if it works.
rm -rf ~/Library/Developer/Xcode/DerivedData
trying to fix a archive build error led me to this error and post
my solution was real simple but took forever for me to figure out.
when i ran $ pod install it generated a workspace for me in the same dir as my .xcodeproj file.
however i had already created a workspace to use as its parent directory.
so then i simply deleted my old workspace and went with the one that pods created
hope this helps someone!
glhf!
For me the fix was rather simple, commit all your changes and build again. The warning disappeared.

Compiling in Xcode

I'm compiling a project that was copied from another application file by file from XCODE IDE.
After compilation I get the following error:
Error: could not read data from '/Users/heziflashner/Documents/#import <UIKit/UIKit.h>
#import "MapKit/MapKit.h"
#import "CoreLocation/UserLocationAddress/salesShare03/salesShare03/salesShare03-Info.plist':
The file “salesShare03-Info.plist” couldn’t be opened because there is no such file.
I'm trying to change the framework directory but with no success.
Any one can help?
For framework headers you must use:
#import <MapKit/MapKit.h>
The problem seems to be that you have a file making a reference to saleseShare03-Info.plist. Be sure you have that in your project tree, even try to remove it and then add it again. Else check your .xcodeproj file and check the settings. Copying a project this way is always tricky, good luck.

UIDevice properties not working in static library

I have created a static library in Iphone SDK in which I used some UIDevice properties.
When I run the app, this xcode show this error
UIDevice Undeclared... Even the same code is running perfectly fine while I don't create static libraries and just build the source files.
Have you tried adding
#import <UIKit/UIKit.h>
...to the top of your class .h file? I was running into similar problems as you are having, but when I added that import into my .h files that seemed to fix a lot of the errors.

Encountering One-off Issue Integrating Dropbox SDK?

I have downloaded the Dropbox API for Objective-C/iOS devices, and I am able to successfully build and run the DBRoulette application.
When I follow the README directions for including the API in my project, I have an enormous number of build errors, all appearing to be related to missing the Foundation header. (Eg. Can't find the interface declaration for NSObject, NSString, etc.)
Many of their header files don't include any other headers at all. Don't all .h files need to import Foundation.h if they extend NSObject? This doesn't seem to be the case, as the example project (DBRoulette) builds and runs fine without the Foundation header declarations, but my own application fails miserably.
I must be missing some sort of project setting, but I can't determine what it is.
Screenshot of One Failing Class
In their example app, they have
#ifdef __OBJC__
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
#endif
in their prefix header file (DBRoulette_Prefix.pch). This file is automatically prefixed to all source files in the project, so the appropriate headers are found. You can either put the #import directives in the source files themselves, or do what they did and edit the .pch file for your project.