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.
I'm using CommonCrypto in a Swift framework - and it's been working fine for over a year.
I used solutions found here: Importing CommonCrypto in a Swift framework
Specifically, to reference CommonCrypto from the Swift framework, I had to:
Create a module.map file in a folder named CommonCrypto next to my framework's Xcode project. module.map contents:
module CommonCrypto [system]
{
header "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/usr/include/CommonCrypto/CommonCrypto.h"
link "CommonCrypto"
export *
}
In my framework project's Swift Import Paths, I add CommonCrypto
In my framework project's Library Search Paths, I include:
$(SDKROOT)/usr/lib/system
In my source, I include: import CommonCrypto
This worked fine; a little convoluted - but it worked.
However, in Xcode 7.3 beta 1 (7D111g), this technique no longer works.
It appears that libcommonCrypto.tbd has been removed from: $(SDKROOT)/usr/lib/system inside Xcode-beta.app. And I can't find it anywhere under the iPhoneOS SDK folder structure.
So I get these errors:
ld: warning: directory not found for option
'-L/Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.3.sdk/usr/lib/system'
ld: library not found for -lCommonCrypto for architecture arm64 clang:
error: linker command failed with exit code 1 (use -v to see
invocation)
It would be great if the crazy module map business was replaced with something simpler. Like for instance, just using import CommonCrypto
In any case, I'm not sure how to resolve this, so any help is appreciated.
I'm asking here as a new question in the event that the solution is substantially different from solutions found in the previous question, although I appreciate this may not be appropriate.
It looks like the solution is to remove the line:
link "CommonCrypto"
from the module.map file.
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
When trying to compile with Xcode, I am getting the following error:
**Ld /Users/doronkatz/Library/Developer/Xcode/DerivedData/iKosher-bphnihrngmqtkqfgievrrumzmyce/Build/Products/Debug-iphonesimulator/iKosher.app/iKosher normal i386
cd /Users/doronkatz/Sites/xCode/iKosher
setenv MACOSX_DEPLOYMENT_TARGET 10.6
setenv PATH "/Xcode4/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Xcode4/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Xcode4/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc-4.2 -arch i386 -isysroot /Xcode4/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.2.sdk -L/Users/doronkatz/Library/Developer/Xcode/DerivedData/iKosher-bphnihrngmqtkqfgievrrumzmyce/Build/Products/Debug-iphonesimulator -L/Users/doronkatz/Sites/xCode/iKosher -F/Users/doronkatz/Library/Developer/Xcode/DerivedData/iKosher-bphnihrngmqtkqfgievrrumzmyce/Build/Products/Debug-iphonesimulator -filelist /Users/doronkatz/Library/Developer/Xcode/DerivedData/iKosher-bphnihrngmqtkqfgievrrumzmyce/Build/Intermediates/iKosher.build/Debug-iphonesimulator/iKosher.build/Objects-normal/i386/iKosher.LinkFileList -mmacosx-version-min=10.6 -all_load -ObjC -Xlinker -objc_abi_version -Xlinker 2 -lz -framework Security -framework CFNetwork -framework CoreData -framework Foundation -framework UIKit -framework CoreGraphics -framework QuartzCore -o /Users/doronkatz/Library/Developer/Xcode/DerivedData/iKosher-bphnihrngmqtkqfgievrrumzmyce/Build/Products/Debug-iphonesimulator/iKosher.app/iKosher
Undefined symbols for architecture i386:
"_UTTypeCreatePreferredIdentifierForTag", referenced from:
+[ASIHTTPRequest mimeTypeForFileAtPath:] in ASIHTTPRequest.o
"_UTTypeCopyPreferredTagWithClass", referenced from:
+[ASIHTTPRequest mimeTypeForFileAtPath:] in ASIHTTPRequest.o
"_kUTTagClassMIMEType", referenced from:
+[ASIHTTPRequest mimeTypeForFileAtPath:] in ASIHTTPRequest.o
"_kUTTagClassFilenameExtension", referenced from:
+[ASIHTTPRequest mimeTypeForFileAtPath:] in ASIHTTPRequest.o
"_SCNetworkReachabilitySetCallback", referenced from:
-[Reachability startNotifier] in Reachability.o
"_SCNetworkReachabilityScheduleWithRunLoop", referenced from:
-[Reachability startNotifier] in Reachability.o
"_SCNetworkReachabilityUnscheduleFromRunLoop", referenced from:
-[Reachability stopNotifier] in Reachability.o
"_SCNetworkReachabilityCreateWithName", referenced from:
+[Reachability reachabilityWithHostName:] in Reachability.o
"_SCNetworkReachabilityCreateWithAddress", referenced from:
+[Reachability reachabilityWithAddress:] in Reachability.o
"_SCNetworkReachabilityGetFlags", referenced from:
-[Reachability currentReachabilityStatus] in Reachability.o
-[Reachability isReachable] in Reachability.o
-[Reachability isConnectionRequired] in Reachability.o
-[Reachability isConnectionOnDemand] in Reachability.o
-[Reachability isInterventionRequired] in Reachability.o
-[Reachability isReachableViaWWAN] in Reachability.o
-[Reachability isReachableViaWiFi] in Reachability.o
...
ld: symbol(s) not found for architecture i386
collect2: ld returned 1 exit status**
Not sure what it means.
If you get this sort of thing appearing suddenly, it usually means the project is missing some frameworks it needs. Libraries and dependent projects can require frameworks, so if you've added one recently then that can cause this error.
To add frameworks, right click on the project name in the project view, select Add, then select Existing frameworks... from the list. Then find the framework with the symbols you're missing.
As to how you find which frameworks you need, I've found using google the easiest, though you could probably use the Xcode help search too. Search for one of the symbols, doing your best to work out the unmangled name (e.g., SCNetworkReachabilityGetFlags), and then the first documentation link you find at developer.apple.com is often the right one. You usually don't have to hunt very far. In this case, that's this page:
https://developer.apple.com/documentation/systemconfiguration/scnetworkreachability-g7d
Then at the top of the page, it tells you which framework to use, SystemConfiguration in this case. So add that to the project, and compile again.
Then just keep doing this until it works...
Edit: I've never used the simulator, but this is what you do on the device - I assume it's the same...
Sometimes there are source files which are missing from your target.
examine which symbols are missing
target->build phases->compile source
add the missing source files if they are not listed
command+b for bliss
You can select the files that seem to be "missing" and check in the right-hand utility bar that their checkboxes are selected for the Target you are building.
You are using ASIHTTPRequest so you need to setup your project. Read the second part here
https://allseeing-i.com/ASIHTTPRequest/Setup-instructions
I solved it using the following method (for XCode 4):
1) Select the project in the project navigation window which will show project summary on right
2) Select 4th tab build phases
3) Select Link binary with library option
4) Add framework for which you are getting
5) Move the framework from main folder to the frameworks folder
6) Build it again and errors are gone.
The problem is that target membership for the added filed is missing to the app target .So select the file and add the checkmark to the box of target membership
For example if the error shown in a method definition in common.m
Thought to add my solution for this, after spending a few hours on the same error :(
The guys above were correct that the first thing you should check is whether you had missed adding any frameworks, see the steps provided by Pruthvid above.
My problem, it turned out, was a compile class missing after I deleted it, and later added it back in again.
Check your "Compile Sources" as shown for the reported error classes. Add in any missing classes that you created.
Make sure that the missing framework is actually listed under "Target/Build Phases/Link Binary With Libraries" if not just add it. As mentioned before it usually indicates a missing framework.
In my project there were two identical framework listed, when I removed one of them I had this error, because it also removed it form the the "Link Binary With Libraries" list.
I added back and the problem disappeared (and I still have two frameworks listed)
I fixed a similar error on my project by changing the Build Settings > Architectures for ALL of my targets.
The problem:
When I upgraded from Xcode 4.4 to Xcode 4.5, my project still compiled fine on the simulator but did not compile on devices. On devices it threw the error "symbol(s) not found for architecture armv7s," along with the misleading "Apple Mach-O Linker Error" and "clang: error: linker command failed with exit code 1 (use -v to see invocation)."
The cause (in my case):
My project had multiple targets, and even though the Build Settings > Architectures for the main target was set to include armv7s architecture, the main target depended on another target (listed under Build Phases > Dependencies), and I hadn't thought to reset the Build Settings > Architectures for that other target, and I had to change that to include armv7s.
I suppose the simulator and device run on different architectures, and that's why the simulator was OK while the device wasn't.
Does your project depend on another project, and is that a target in that project set up to be a direct dependency of your main target? If this is the case and the dependency isn't set up, the dependent target may not be getting built for all configurations (i.e. the simulator)
Just a wild guess.
Another situation that can cause this problem is if your code calls into C++, or is called by C++ code. I had a problem with my own .c file's utility function showing up as "symbol not found" when called from Obj-C. The fix was to change the file type: in Xcode 4, use the extended info pane to set the file type to "Objective-C++ Source"; in Xcode 3, use "Get Info" to change file type to "source.cpp.objcpp".
In my case none of the posted solutions worked. I had to delete the project and make a fresh checkout from the SVN server. Lucky me the project was hosted in a version control system. Don't know what I'd do otherwise.
In a C++ project using a defined templatized class, while receiving the same error, I selected .cpp file with the defined templatized class in the Project Navigator, then Delete > Remove Reference. Also the associated .h file, while still referenced in the project, needs to have a #include statement to the .cpp as follows:
#ifndef __CircularBuffer__CircularBufferT__
#define __CircularBuffer__CircularBufferT__
... snip ...
#include "CircularBufferT.cpp"
#endif /* defined(__CircularBuffer__CircularBufferT__) */
If you want to see, a simple project example is on github:
This is a little bit of indirection trickery and I don't recall the original source of this workaround.
If this error appears suddenly, it means the project is missing some frameworks. Libraries and dependent projects can require frameworks, so if you've added one recently then that can cause this error.
To add frameworks, right click on the project name in the project view, select Add, then select Existing frameworks from the list. Then find the framework with the symbols you're missing.
The other thing is if you added any classes in the compiled resources and removed that classes from the project then the error appears. The best thing to do is remove the classes from the compile resources(Build settings--> compile sources) which have removed from the project.
In my case i have added the admob classes in the project and compiled the project. In a later case i dont want to include admobs in my project so i deleted the references of the admob classes from my project. When this error occurred i deleted the .m class of my admob from compile resources solved this problem.
This happened to me while trying to copy over the PSPDFKIT demo library into my project. I followed all the instructions in the site + all the suggestions on this page.. for some reason it kept on giving the above error, the problem was that if i grepped the message in the error method.. it only appeared in the binary (obviously I have no access to the source code b/c I have to pay for it).
I noticed this in the instruction page though:
So I went to the guts of that config file and found this:
OTHER_LDFLAGS=$(inherited) -ObjC -fobjc-arc -lz -framework CoreText -framework CoreMedia -framework MediaPlayer -framework AVFoundation -framework ImageIO -framework MediaPlayer -framework MessageUI -framework CoreGraphics -framework Foundation -framework QuartzCore -framework AVFoundation -framework CFNetwork -framework MobileCoreServices -framework SystemConfiguration -weak_framework UIKit
Then I went to the sample project provided by the author of the said library.. and noticed that the previous flags where copied verbatim to the other linker flags in my build settings.. however in my project.. they were not!.. So i simply copied and pasted them into my project's build settings other linker flags and everything worked!
take away point: if you are relying on some .xcconfig file on your setup, double check with a sample code source or something and make sure that it has actually been applied.. it wasn't applied properly in my case
Another reason this could be happening is when you UPGRADE an SDK.
If you simply delete the group, and then drag and drop the new folder to project, the "Library Search Path" would have both the SDKs. To solve, simply delete the old SDK path.
I had used a CLGeocoder without adding a Core.Location Framework. Basically this error can mean multiple things. I hope this helps someone else.
I've been stumped by this one before only to realize I added a data-only #interface and forgot to add the empty #implementation block.
Came across this issue in Xcode 11, fix was changing the Minimum Deployment Target from 10.0 to 11.0, hope this helps someone :)
This had been driving me crazy....
I have an iPhone app that is using an Apple sample cpp file. The cpp file is aqofflinerender.cpp.
When I compile the Apple sample project, AQOfflineRenderTest, it compiles correctly. When I copy the aqofflinerender.cpp file to my project and reference a method within the file exactly as the Apple sample, I get the following error:
cd /Users/mike/Documents/xcode/insultthem
setenv IPHONEOS_DEPLOYMENT_TARGET 3.0
setenv MACOSX_DEPLOYMENT_TARGET 10.5
setenv PATH "/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:/opt/local/bin:/usr/local/git/bin"
/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/g++-4.2 -arch armv6 -isysroot /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.0.sdk "-L/Users/mike/XCode Projects/Debug-iphoneos" "-F/Users/mike/XCode Projects/Debug-iphoneos" -filelist "/Users/mike/XCode Projects/insultthem.build/Debug-iphoneos/insultthem.build/Objects-normal/armv6/insultthem.LinkFileList" -mmacosx-version-min=10.5 -Wl,-dead_strip -miphoneos-version-min=3.0 -framework Foundation -framework UIKit -framework CoreGraphics -framework AVFoundation -framework SystemConfiguration -framework AudioToolbox -framework CoreData -framework MessageUI -framework IOKit -o "/Users/mike/XCode Projects/Debug-iphoneos/insultthem.app/insultthem"
Undefined symbols:
"_DoAQOfflineRender", referenced from:
-[AudioFileManipulation combineFiles:newFileName:] in AudioFileManipulation.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
In .m file, the method is defined as follows:
extern void DoAQOfflineRender(CFURLRef sourceURL1, CFURLRef sourceURL2, CFURLRef sourceURL3, CFURLRef destinationURL);
In the .cpp file, the method is as follows:
void DoAQOfflineRender(CFURLRef sourceURL1, CFURLRef sourceURL2, CFURLRef sourceURL3, CFURLRef destinationURL) {
Does anyone have any suggestions for resolving this?
Ok... Figured it out.... according to another post, in the aqofflinerender.cpp file, I surrounded the function as follows:
#if __cplusplus
extern "C" {
#endif
void DoAQOfflineRender(CFURLRef sourceURL, CFURLRef destinationURL)
{
...
}
#if __cplusplus
}
#endif
Weird.... cause it works in the Apple example without the #if __cplusplus lines. Guessing that there is a compiler option missing in my project...
These lines tell the compiler to export the function name as the symbol so the other classes can "see" the function.
Doesn't the Apple code come with an include file too? Usually, example code made from Apple always has an include file.
If there is that file, you need to use it too, I think.
Have you tried changing the .cpp file to a .mm file? I vaguely remember something like that's what the compiler expects when there's a mix of objective-c and c++.