How do I make use of SSLSetALPNProtocols? - swift

I'm working on a TLS library for the vapor project and am supporting both Apple's (Transport-)Security and OpenSSL for use in an HTTP/2 client and server.
On this line of code I'm trying to call SSLSetALPNProtocols. Regardless of my approach, I'm met with an ld linker error on that line of code.
Undefined symbols for architecture x86_64:
"_SSLSetALPNProtocols", referenced from:
__T08AppleSSL9SSLOptionV4alpnACSaySSG9protocols_tFZySo10SSLContextCKcfU_ in Options.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
There's no documentation available to highlight a possible obvious mistake since the page is empty.
So, how do I get this code to compile with ALPN support?

Currently that's impossible. Apple forgot to export the SSLSetALPNProtocols and SSLCopyALPNProtocols function.
I already filed rdar://34790589 (duplicate of rdar://33907676)

As of the latest macOS and Xcode beta with Swift 4.1 I've got this up and running.

Related

Linker error for DOMXPathResult and DOMXPathExpression in Swift

I'm trying to use DOMXPathResult/DOMXPathExpression in my Swift application but get for some reasons a linker error for both. Other classes from the WebKit framework compile/link nicely. Both XPath classes also link in an Obj-C application. It's only a problem in Swift. WebKit is imported and linked to.
The error message I get is:
Undefined symbols for architecture x86_64:
"_OBJC_CLASS_$_DOMXPathExpression", referenced from:
__TMaCSo18DOMXPathExpression in PluginWorker.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
How can I solve this linker error?
This has been fixed with XCode 7.1.1.

error on AdMob integration

I Have added Addmob sdk in my project and even added all framework needed. But m getting below error for StoreKit framework even i have added it in my project but still getting error..
ld: warning: directory not found for option '- L/Users/company/Downloads/projectname/GoogleAdMobAdsSdkiOS-6.4.2/Add- ons/GoogleAnalyticsiOS_2.0beta4/Library'
ld: warning: directory not found for option '-L/Users/company/Downloads/projectname/GoogleAdMobAdsSdkiOS-6.4.2'
ld: warning: ignoring file /Users/company/Downloads/StoreKit.framework/StoreKit, missing required architecture i386 in file /Users/company/Downloads/StoreKit.framework/StoreKit (2 slices)
Undefined symbols for architecture i386:
"_OBJC_CLASS_$_SKStoreProductViewController", referenced from:
objc-class-ref in libGoogleAdMobAds.a(GADOpener.o)
"_SKStoreProductParameterITunesItemIdentifier", referenced from:
-[GADOpener openInAppStore:fallbackURLString:] in libGoogleAdMobAds.a(GADOpener.o)
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I search a lot but in every post its sid to add Storkit.. but i have already added it but still getting error. even i have cleaned the project a lot of time.
Just ensure that you have added the following libraries,
1.AudioToolbox
2.MessageUI
3.SystemConfiguration
4.CoreGraphics
Also the frameworks,
1.MessageUI.framework
2.StoreKit.framework
3.SystemConfiguration.framework
According to your error message there is a problem with StoreKit.framework...Please verify that...
Refer: build error when add Admob in iOS app
Add AdSupport.framework, also make it as optional
It says that your StoreKit binary is not build for i386. This should not happen with the default one. Did you download if separately from somewhere? You can find the default here:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer‌​/SDKs/iPhoneOS6.1.sdk/System/Library/Frameworks/StoreKit.framework
Use that.

ignoring file [path] missing required architecture i386 in file

I'm quite new to Xcode and Iphone development and ran into the following problem:
I opened a new project and added *.h and a *.a files (which I recived from a certain device vendor).
I get the following warning:
ld: warning: ignoring file /Users/udi/Desktop/Xcode/Xcode Projects/Scosche/libmyTrekSDK_armv7.a, missing required architecture i386 in file /Users/udi/Desktop/Xcode/Xcode Projects/Scosche/libmyTrekSDK_armv7.a (2 slices)
If I ignore the warning, and try to instanciate the class that is given to me in the header file, I get these errors:
ld: warning: ignoring file [Path/FileName.a], missing required architecture i386 in file [Path/FileName.a] (2 slices)
Undefined symbols for architecture i386:
"_OBJC_CLASS_$_HRMonitor", referenced from:
objc-class-ref in ViewController.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see
invocation)
I've checked the Framework Search Pathes (as mantioned in many other posts) and it clear.
More info:
I'm Using Xcode 4.6.1
The files are currently located at project's root folder.
I'm using a Single View Application tamplate.
Appreciate any help
This warning means that you're trying to use library made for Device (ARM) with your Simulator (i386).
You can use this terminal command to create a universal library:
lipo -create lib_arm.a lib_i386.a -output lib_universal.a
More info about lipo command here.
Change your target's "Build Settings > Build Active Architectures Only" to "No"
This is doing the same thing as Dmitry Zhukov's answer but doing it thru Xcode instead of going around its back.
If you are working with a 3rd party code, keep in mind that some SDKs may not work on the simulator. The same build error I have encountered vanished, when I ran the project on the device.

How to use Springboard framework in xcode 4.3.1

I want to use "springboard" framework , I have added that framework by drag and drop in xcode downloading from github.com , but when I want to run it I got some error :
Undefined symbols for architecture i386:
"_SBSCopyLocalizedApplicationNameForDisplayIdentifier", referenced
from:
-[ViewController getActiveApps] in ViewController.old: symbol(s) not found for architecture i386 clang: error: linker command
failed with exit code 1 (use -v to see invocation)
why this error any one have any idea. I think have some issue in "headersearch path" setting any one kindly say how to set this .
Thanks.
Having the headers is not enough, you have to link to the springboard binary as well.
However, I'm pretty sure the springboard is not available inside an application, so even if you get it to link, I'm pretty sure calling any springboard method will fail.
What you need to do to use springboard's methods is to make a mobile substrate extension.

Undefined symbols for architecture i386 when adding FaceBook Connect

I have the following failed code when i run my application on iPhone 5.1 simulator. My app runs smoothly before i add in the Facebook Connect into my application.
Undefined symbols for architecture i386:
"_FBCreateNonRetainingArray", referenced from:
-[FBSession initWithKey:secret:getSessionProxy:] in FBSession.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
May I know what can i do to get rid of this?
Thanks
2 things that usually get rid of that error.
1) go to: target > build phases > link binary with library -- make sure you've added the correct framework
2) go to: target > build phases > compile sources -- add any implementation files that are in your program but do not appear in that list.
Those two steps usually fix that kind of error.