iPhone libxml2 not found during build - iphone

I currently got some errors with libxml2 in my iPhone project. This was working before, after making some changes in my build properties building failed. (libxml2.dylib is added in the build phases)
#import <libxml/tree.h>
#import <libxml/parser.h>
#import <libxml/xmlstring.h>
#import <libxml/xpath.h>
#import <libxml/xpathInternals.h>
I've added the following items to the Build Settings:
Other Linker Flags: -lxml2
Header Search Paths: /usr/include/libxml2
I've tried adding them to the project and targets (at the same time, and switching between them) without any difference.
I also tried adding the following to the Header Search Path:
${SDKROOT}
${SDK_DIR}
Both with no result.
Building fails for:
iPhone device
iPhone and iPad emulator
Anyone have an idea?
I'm using the GData Objective-C client library: http://code.google.com/p/gdata-objectivec-client/
I'm compiling the source files directly into my project and followed all the steps that are given in the wiki. When manually importing the libxml headers again, XCode suggests the following:
#import <libxml2/libxml/tree.h>
Which doesn't work either.

Add ${SDKROOT}/usr/include/libxml2 as a header search path instead of only ${SDKROOT}.
Watch out that you all build targets that need libxml get the extra search path. If you add the path to your project's build settings, all its targets will inherit it and there shouldn't be a problem.

Add libxml2.dylib in Build Phases.
Add TFHpple.m, TFHppleElement.m, XpathQuery.m to Build Phases (Compile Sources).
Add Other Linker Flags: -lxml2 Header Search Paths: ${SDK_DIR}/usr/include/libxml2
in PROJECT --> Build Phases and in TARGETS --> Build Phases.

Related

mailcore2 how to implement it in swift

I tired to follow these instructions here https://github.com/MailCore/mailcore2/blob/master/build-mac/README.md but I didnt understand or dont know how to implement it in my swift app.
I know how to set up the session etc but how to install mailcore2 library onto my app is what im having problems with.
One of the things that worked for me without pods nor carthage was to download the mailcore2 library and copy the whole mailcore2 folder to the project folder. then follow this steps:
Go to Build Phases from your build target, and under 'Link Binary With Libraries',
Add libMailCore-ios.a
Add CFNetwork.framework
Add Security.framework
Set 'Other Linker Flags' under Build Settings:
-lctemplate-ios -letpan-ios -lxml2 -lsasl2 -liconv -ltidy -lz -lc++ -lresolv -stdlib=libc++ -ObjC
Make sure to use LLVM C++ standard library. Open Build Settings, scroll down to 'C++ Standard Library', and select libc++.
In Build Phases, add a Target Dependency of static mailcore2 ios.
For Swift - If you are using Mailcore in a Swift project you also need to complete the following steps:
* Create a new header file in your project and name it Project-Name-Bridging-Header.h.
* Remove any template code from the file and add #import
* In your target settings search for Objective-c Bridging Header and add a link to your bridging header. (Project-Name-Bridging-Header.h)
* You do not need to import Mailcore in any of your classes as the bridging header takes care of this automatically.

<CocoaLumberjack/CocoaLumberjack.h> file not found in bridging file

I have a workspace with multiple targets and mixed development with SWIFT and Objective-C. After installing CocoaLumberjack with CocoaPods:
pod 'CocoaLumberjack/Swift'
I can use it my project without any problems. All my targets get compiled except Test target. When I run tests I get "build failed" error within the bridging header file
<CocoaLumberjack/CocoaLumberjack.h> file not found
at:
#import <CocoaLumberjack/CocoaLumberjack.h>
Do you have any ideas how to fix the issue? Thanks!

How to create a React-Native framework using Swift

I have a react native component written in Swift, and I want to extract it as a framework so other project/people can use it easily.
First I created a new iOS project Foo, added a framework target,
then added source files. Finally, I built it.
It failed because:
Bar.swift:[lineNumber]: Use of unresolved identifier 'RCTConvert'
RNBarManager.swift:[lineNUmber]: Use of undeclared type 'RCTViewManager'
Attempt 1:
I ran react-native link, but nothing changed.
Attempt 2:
Drag React.xcodeproj to Foo project and add libReact.a to Link
Binary With Libraries.
Add $(SRCROOT)/../node_modules/react-native/React to Header Search Paths.
But it doesn't work. The error still remains.
Attempt 3:
I was thinking maybe Swift doesn't recognize these files.
So I added Foo-Bridging-Headers.h like I did in a React-Native App, which contains the following code:
#import "React/RCTBridge.h"
#import "React/RCTViewManager.h"
#import "React/RCTUIManager.h"
#import "React/UIView+React.h"
#import "React/RCTBridgeModule.h"
I also added Foo-Bridging-Headers.h to Build Settings->Swift Compiler - General->Object-C Bridging Header,
Still I got an error.
using bridging headers with framework targets is unsupported
It seems bridging headers are not allowed here.
Attempt 4:
I tried to add these imports to Foo.h,
but got an error again.
Foo.h:21:9: Include of non-modular header inside framework module 'Foo'
What should I do to compile successfully?
This seems like an issue with the cocoa pods required for linking React to your project.
Try running pod install in your project directory using terminal and then try to build.
The linking happens in the hosting app, and not in the framework you've made. That will just need the headers.

Integrate Linphone app to my iOS app

There are about 20 questions on Linphone ios build in StackOverflow. A couple of them ask about integrating Linphone to an existing xcode project. I have followed them all. I am able to build and run the Linphone project successfully.
However, to integrate to my existing project, I have included:
linphone-sdk/apple-darwin/include and linphone-sdk/apple-darwin/lib to my project.
the following lines to Xcode project->Build Settings->Search Path/Header Search Path: submodules/linphone/coreapi submodules/linphone/mediastreamer2/include
submodules/linphone/mediastreamer2/include submodules/linphone/oRTP/include submodules/externals/gsm/ submodules/externals/osip/include submodules/externals/exosip/include submodules/externals/speex/include Classes/Utils/NinePatch/ Classes/Utils/XMLRPC/
marking all .a with target membership to my current target
What else should i do to get Linphone working in my project? Or should I make a static library of Linphone? If Yes, what things should i take care about?
To be able to build and run Linphone on a Swift project I had to the following steps:
Downlaod the latest SDK (with wget) from:
http://www.linphone.org/snapshots/ios/liblinphone-iphone-sdk-latest.zip
Copy,paste and insert in the project:
liblinphone-sdk/apple-darwin/include
liblinphone-sdk/apple-darwin/lib
liblinphone-sdk/apple-darwin/share/images
liblinphone-sdk/apple-darwin/share/sounds
Create a Bridging-Header.h with:
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
#import <linphone/linphonecore.h>
Create a PrefixHeader.pch which import your Bridging-Header:
#import "Bridging-Header.h"
Integrate The following pods:
pod 'xmlrpc', '~> 2.3.4'
pod 'Tortuga22-NinePatch', '~> 0.1.1'
Configure the build Settings:
`
GCC_PRECOMPILE_PREFIX_HEADER = YES
GCC_PREFIX_HEADER = path/to/PrefixHeader.pch
OTHER_LDFLAGS = -ObjC $(inherited)
FRAMEWORK_SEARCH_PATHS = $(inherited)
HEADER_SEARCH_PATHS = $(inherited) ${PODS_ROOT}/Headers/Public $(PROJECT_DIR)/External/liblinphone-sdk/apple-darwin/include
LIBRARY_SEARCH_PATHS = $(inherited) $(PROJECT_DIR)/External/liblinphone-sdk/apple-darwin/lib $(PROJECT_DIR)/External/liblinphone-sdk/apple-darwin/lib/mediastreamer/plugins
`
Configure the macros:
`
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) HAVE_OPENH264 HAVE_SILK HAVE_SSL
OTHER_SWIFT_FLAGS = $(inherited) -D HAVE_OPENH264 -D HAVE_SILK -D HAVE_SSL
`
Libraries and Framework:
First add all the libs from the folder (and subfolders) liblinphone-sdk/apple-darwin/lib.
Then be sure to add the following list:
Pods:
libPods.a
Dynamic Libs:
libz.dylib
libiconv.dylib
libxml2.dylib
libsqlite3.dylib
libc++.dylib
libstdc++.6.dylib
libresolv.dylib
Frameworks: (sorry I'm not sure if they are all 100% needed but this is how I managed to get the lib to build)
AudioToolbox.framework
UIKit.framework
QuartzCore.framework
OpenGLES.framework
MessageUI.framework
MediaPlayer.framework
CoreGraphics.framework
MobileCoreServices.framework
AddressBookUI.framework
AddressBook.framework
SystemConfiguration.framework
CFNetwork.framework
AssetsLibrary.framework
AVFoundation.framework
CoreAudio.framework
CoreMedia.framework
CoreTelephony.framework
CoreVideo.framework
Foundation.framework
CoreLocation.framework
How to test:
To verify that it was working, I integrated some sample code from the Linphone app and made some minor setups in my view controllers.
To do so I integrated in the project the following classes:
Utils.[h, m]
LinphoneManager.[h, m]
LinphoneCoreSettingsStore.[h, m]
FastAddressBook.[h, m]
LinphoneIOSVersion.h
pod 'InAppSettingsKit', '~> 2.6'
PS: I had to update them in order to build without warnings or errors.
I hope this will help someone one day!
Check with below Header Search Paths. Also set Other Linker Flags -ObjC

AppViewController and Delegate extension changed to .mm, #import "OpenFeint.h" gives error that OpenFeint requires Obj-C++

I downloaded OpenFeint version 2.3.1, unzipped and placed the OpenFeint folder inside right underneath my project in Xcode, and checked "recursively create groups if needed" (the instructions said to use groups and not a folder reference).
I renamed my AppViewController and AppDelegate .m files to .mm. I followed the rest of the instructions and compiled and ran, the app works fine.
Inside AppViewController.mm I do:
#import "OpeinFeint.h"
and compile, which gives me the errors:
#error: "OpenFeint requires Objective-C++. In Xcode, you can enable this by changing your file's extension to .mm".
#error: syntax error before 'OfNotificationCategory'
#error: syntax error before 'OfNotificationCategory'
and the location of the errors takes me to the OpenFeint files.
I did add -ObjC to Other Linker Flags and check Call C++ Default Ctors/Dtors in Objective-C.
Any advice? Thanks!
The linker flag should be -lobjc, not -ObjC.