How to Embedding Cordova WebView on iOS - ios

First,I create an xcode project ,then I add the Cordova to the project
I made this step by step with this tutorial: http://docs.phonegap.com/en/2.2.0/guide_cordova-webview_ios.md.html#Embedding%20Cordova%20WebView%20on%20iOS
but still got the error
Libtool /Users/wanyc/Library/Developer/Xcode/DerivedData/TestCordova-bmqmtqdeafhklhbjqbnmochohdoe/Build/Products/Debug-iphonesimulator/libCordova.a normal i386
cd /Users/wanyc/Downloads/infoviz-ios-master/CordovaLib
setenv IPHONEOS_DEPLOYMENT_TARGET 5.1
setenv PATH "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool -static -arch_only i386 -syslibroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator6.0.sdk -L/Users/wanyc/Library/Developer/Xcode/DerivedData/TestCordova-bmqmtqdeafhklhbjqbnmochohdoe/Build/Products/Debug-iphonesimulator -filelist /Users/wanyc/Library/Developer/Xcode/DerivedData/TestCordova-bmqmtqdeafhklhbjqbnmochohdoe/Build/Intermediates/CordovaLib.build/Debug-iphonesimulator/CordovaLib.build/Objects-normal/i386/Cordova.LinkFileList -all_load -Obj-C -lsqlite3.0 -o /Users/wanyc/Library/Developer/Xcode/DerivedData/TestCordova-bmqmtqdeafhklhbjqbnmochohdoe/Build/Products/Debug-iphonesimulator/libCordova.a
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool: unknown option character `O' in: -Obj-C
Usage: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool -static [-] file [...] [-filelist listfile[,dirname]] [-arch_only arch] [-sacLT]
Usage: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool -dynamic [-] file [...] [-filelist listfile[,dirname]] [-arch_only arch] [-o output] [-install_name name] [-compatibility_version #] [-current_version #] [-seg1addr 0x#] [-segs_read_only_addr 0x#] [-segs_read_write_addr 0x#] [-seg_addr_table <filename>] [-seg_addr_table_filename <file_system_path>] [-all_load] [-noall_load]
Command /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool failed with exit code 1
I find the error cased by this 'Add -all_load and -Obj-C - for the "Other Linker Flags" value'

That should be -ObjC, not -Obj-C. Here's an example in Apple's documentation.
(Also, please don't show screenshots of compiler errors -- they get resized so small that they're nearly unreadable. You can copy and paste the text out of the error log.)

Related

Mach-O Librarian error while adding OAuthSwift cocoapod

I'm trying to build an xcode project developing in swift using the OAuthSwift Cocoapod. I'm getting an error with the compiler is creating a static library. Error posted below..
Libtool /Users/Josh/Library/Developer/Xcode/DerivedData/Whistle-gvivrqpbrrykshduohmpjjdibxka/Build/Products/Debug-iphonesimulator/libPods-OAuthSwift.a normal x86_64
cd "/Users/Josh/Desktop/MOB 01/whistle/whistle/Pods"
export IPHONEOS_DEPLOYMENT_TARGET=8.0
export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool -static -arch_only x86_64 -syslibroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator8.1.sdk -L/Users/Josh/Library/Developer/Xcode/DerivedData/Whistle-gvivrqpbrrykshduohmpjjdibxka/Build/Products/Debug-iphonesimulator -filelist /Users/Josh/Library/Developer/Xcode/DerivedData/Whistle-gvivrqpbrrykshduohmpjjdibxka/Build/Intermediates/Pods.build/Debug-iphonesimulator/Pods-OAuthSwift.build/Objects-normal/x86_64/Pods-OAuthSwift.LinkFileList -L/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator -Xlinker -add_ast_path -Xlinker /Users/Josh/Library/Developer/Xcode/DerivedData/Whistle-gvivrqpbrrykshduohmpjjdibxka/Build/Intermediates/Pods.build/Debug-iphonesimulator/Pods-`OAuthSwift`.build/Objects-normal/x86_64/Pods_OAuthSwift.swiftmodule -framework Foundation -o /Users/Josh/Library/Developer/Xcode/DerivedData/Whistle-gvivrqpbrrykshduohmpjjdibxka/Build/Products/Debug-iphonesimulator/libPods-OAuthSwift.a
error: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool: unknown option character `X' in: -Xlinker
Usage: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool -static [-] file [...] [-filelist listfile[,dirname]] [-arch_only arch] [-sacLT] [-no_warning_for_no_symbols]
Usage: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool -dynamic [-] file [...] [-filelist listfile[,dirname]] [-arch_only arch] [-o output] [-install_name name] [-compatibility_version #] [-current_version #] [-seg1addr 0x#] [-segs_read_only_addr 0x#] [-segs_read_write_addr 0x#] [-seg_addr_table <filename>] [-seg_addr_table_filename <file_system_path>] [-all_load] [-noall_load]
Any Suggestions??
UPDATE: Podfile below
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
pod 'LayerKit'
pod 'SwiftyJSON'
pod 'OAuthSwift'

bug compiling alamofire - unknown option character `X' in: -Xlinker

Trying to add alamofire to a project using cocoapods.
Xcode version: Version 6.1.1 (6A2008a)
Podfile:
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
pod 'OAuth.io'
pod 'Alamofire', '~> 1.1'
Here's the error:
Libtool /Users/tony/Library/Developer/Xcode/DerivedData/Candytone-aynufizixrzmtwgatrvrjynlonxv/Build/Products/Debug-iphonesimulator/libPods-Alamofire.a normal x86_64
cd /Users/tony/src/candytone-ios/Candytone/Pods
export IPHONEOS_DEPLOYMENT_TARGET=8.1
export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool -static -arch_only x86_64 -syslibroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator8.1.sdk -L/Users/tony/Library/Developer/Xcode/DerivedData/Candytone-aynufizixrzmtwgatrvrjynlonxv/Build/Products/Debug-iphonesimulator -filelist /Users/tony/Library/Developer/Xcode/DerivedData/Candytone-aynufizixrzmtwgatrvrjynlonxv/Build/Intermediates/Pods.build/Debug-iphonesimulator/Pods-Alamofire.build/Objects-normal/x86_64/Pods-Alamofire.LinkFileList -L/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator -Xlinker -add_ast_path -Xlinker /Users/tony/Library/Developer/Xcode/DerivedData/Candytone-aynufizixrzmtwgatrvrjynlonxv/Build/Intermediates/Pods.build/Debug-iphonesimulator/Pods-Alamofire.build/Objects-normal/x86_64/Pods_Alamofire.swiftmodule -framework Foundation -o /Users/tony/Library/Developer/Xcode/DerivedData/Candytone-aynufizixrzmtwgatrvrjynlonxv/Build/Products/Debug-iphonesimulator/libPods-Alamofire.a
error: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool: unknown option character `X' in: -Xlinker
Usage: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool -static [-] file [...] [-filelist listfile[,dirname]] [-arch_only arch] [-sacLT] [-no_warning_for_no_symbols]
Usage: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool -dynamic [-] file [...] [-filelist listfile[,dirname]] [-arch_only arch] [-o output] [-install_name name] [-compatibility_version #] [-current_version #] [-seg1addr 0x#] [-segs_read_only_addr 0x#] [-segs_read_write_addr 0x#] [-seg_addr_table <filename>] [-seg_addr_table_filename <file_system_path>] [-all_load] [-noall_load]
The issue was solved by upgrading to Cocoapods 0.36beta.
gem install cocoapods --pre
I also had to remove the old version.
gem uninstall cocoapods

Swift in iOS Cocoa Touch Static Library

I'm trying to use swift in a cocoa static library but the compiler is spitting back at me this:
Libtool /Users/USERNAME/Library/Developer/Xcode/DerivedData/SwiftFramework-gmerfrjnryqwvmbjvschjjxdjyvs/Build/Products/Debug-iphoneos/libSwiftFramework.a normal arm64
cd /Users/USERNAME/Code/Examples/SwiftFramework
export IPHONEOS_DEPLOYMENT_TARGET=8.1
export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool -static -arch_only arm64 -syslibroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.1.sdk -L/Users/USERNAME/Library/Developer/Xcode/DerivedData/SwiftFramework-gmerfrjnryqwvmbjvschjjxdjyvs/Build/Products/Debug-iphoneos -filelist /Users/USERNAME/Library/Developer/Xcode/DerivedData/SwiftFramework-gmerfrjnryqwvmbjvschjjxdjyvs/Build/Intermediates/SwiftFramework.build/Debug-iphoneos/SwiftFramework.build/Objects-normal/arm64/SwiftFramework.LinkFileList -L/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos -Xlinker -add_ast_path -Xlinker /Users/USERNAME/Library/Developer/Xcode/DerivedData/SwiftFramework-gmerfrjnryqwvmbjvschjjxdjyvs/Build/Intermediates/SwiftFramework.build/Debug-iphoneos/SwiftFramework.build/Objects-normal/arm64/SwiftFramework.swiftmodule -o /Users/USERNAME/Library/Developer/Xcode/DerivedData/SwiftFramework-gmerfrjnryqwvmbjvschjjxdjyvs/Build/Products/Debug-iphoneos/libSwiftFramework.a
error: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool: unknown option character `X' in: -Xlinker
Usage: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool -static [-] file [...] [-filelist listfile[,dirname]] [-arch_only arch] [-sacLT] [-no_warning_for_no_symbols]
Usage: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool -dynamic [-] file [...] [-filelist listfile[,dirname]] [-arch_only arch] [-o output] [-install_name name] [-compatibility_version #] [-current_version #] [-seg1addr 0x#] [-segs_read_only_addr 0x#] [-segs_read_write_addr 0x#] [-seg_addr_table <filename>] [-seg_addr_table_filename <file_system_path>] [-all_load] [-noall_load]
This happens from creating a new project that is the Cocoa Touch Static Library and then adding an empty swift file to the target.
unknown option character `X' in: -Xlinker
Has anyone seen this when trying this in a static library?

How can I distribute a mix of Objective-C and Swift code to be run on the iOS simulator?

I have a set of Swift and Objective-C files that extend some of the functionality in the XCTest framework.
I was easily able to create a Cocoa framework composed of these files. I added all the files to an OS X framework target and, since some of them import XCTest headers, I linked XCTest.framework to my framework. Users are able to add the framework to their unit test targets, provided they are building for OS X.
Question: How can I do the same (i.e.: distribute this code) for users building for the iOS simulator?
What I've Tried (1): Cocoa Touch framework
I can't make a Cocoa Touch framework that imports XCTest.framework--doing so results in the following linker error ("Quick" is the name of the framework):
Ld /Users/modocache/Library/Developer/Xcode/DerivedData/Quick-cajmiuprocunntdhiwsnsfzqydkc/Build/Products/Debug-iphonesimulator/Quick-iOS.framework/Quick-iOS normal x86_64
cd /Users/modocache/GitHub/modocache/Quick
export IPHONEOS_DEPLOYMENT_TARGET=8.0
export PATH="/Applications/Xcode6-Beta.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode6-Beta.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Applications/Xcode6-Beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch x86_64 -dynamiclib -isysroot /Applications/Xcode6-Beta.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator8.0.sdk -L/Users/modocache/Library/Developer/Xcode/DerivedData/Quick-cajmiuprocunntdhiwsnsfzqydkc/Build/Products/Debug-iphonesimulator -F/Users/modocache/Library/Developer/Xcode/DerivedData/Quick-cajmiuprocunntdhiwsnsfzqydkc/Build/Products/Debug-iphonesimulator -F/Applications/Xcode6-Beta.app/Contents/Developer/Library/Frameworks -filelist /Users/modocache/Library/Developer/Xcode/DerivedData/Quick-cajmiuprocunntdhiwsnsfzqydkc/Build/Intermediates/Quick.build/Debug-iphonesimulator/Quick-iOS.build/Objects-normal/x86_64/Quick-iOS.LinkFileList -install_name #rpath/Quick-iOS.framework/Quick-iOS -Xlinker -rpath -Xlinker #executable_path/Frameworks -Xlinker -rpath -Xlinker #loader_path/Frameworks -Xlinker -objc_abi_version -Xlinker 2 -Xlinker -no_implicit_dylibs -mios-simulator-version-min=8.0 -framework XCTest -single_module -compatibility_version 1 -current_version 1 -Xlinker -dependency_info -Xlinker /Users/modocache/Library/Developer/Xcode/DerivedData/Quick-cajmiuprocunntdhiwsnsfzqydkc/Build/Intermediates/Quick.build/Debug-iphonesimulator/Quick-iOS.build/Objects-normal/x86_64/Quick-iOS_dependency_info.dat -o /Users/modocache/Library/Developer/Xcode/DerivedData/Quick-cajmiuprocunntdhiwsnsfzqydkc/Build/Products/Debug-iphonesimulator/Quick-iOS.framework/Quick-iOS
ld: building for iOS Simulator, but linking against dylib built for MacOSX file '/Applications/Xcode6-Beta.app/Contents/Developer/Library/Frameworks/XCTest.framework/XCTest' for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
What I've Tried (2): Cocoa Touch static library
Other projects similar to mine that extend the XCTest framework use static libraries to distribute their code. However, attempting to build a static library that includes Swift code results in the following error:
Libtool /Users/MBP-006FYGC/Library/Developer/Xcode/DerivedData/Quick-chbdhbmwzcgjlyfsbxuvmajagydy/Build/Products/Debug/libQuick-OSX.a normal x86_64
cd /Users/MBP-006FYGC/GitHub/modocache/Quick
export MACOSX_DEPLOYMENT_TARGET=10.7
/Applications/Xcode6-Beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool -static -arch_only x86_64 -syslibroot /Applications/Xcode6-Beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk -L/Users/MBP-006FYGC/Library/Developer/Xcode/DerivedData/Quick-chbdhbmwzcgjlyfsbxuvmajagydy/Build/Products/Debug -filelist /Users/MBP-006FYGC/Library/Developer/Xcode/DerivedData/Quick-chbdhbmwzcgjlyfsbxuvmajagydy/Build/Intermediates/Quick.build/Debug/Quick-OSX.build/Objects-normal/x86_64/Quick-OSX.LinkFileList -ObjC -L/Applications/Xcode6-Beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx -Xlinker -rpath -Xlinker /Applications/Xcode6-Beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx -Xlinker -force_load -Xlinker /Applications/Xcode6-Beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/arc/libarclite_macosx.a -Xlinker -sectalign -Xlinker __SWIFT -Xlinker __ast -Xlinker 4 -Xlinker -sectcreate -Xlinker __SWIFT -Xlinker __ast -Xlinker /Users/MBP-006FYGC/Library/Developer/Xcode/DerivedData/Quick-chbdhbmwzcgjlyfsbxuvmajagydy/Build/Intermediates/Quick.build/Debug/Quick-OSX.build/Objects-normal/x86_64/Quick_OSX.swiftmodule -framework XCTest -framework Foundation -o /Users/MBP-006FYGC/Library/Developer/Xcode/DerivedData/Quick-chbdhbmwzcgjlyfsbxuvmajagydy/Build/Products/Debug/libQuick-OSX.a
error: /Applications/Xcode6-Beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool: unknown option character `X' in: -Xlinker
Usage: /Applications/Xcode6-Beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool -static [-] file [...] [-filelist listfile[,dirname]] [-arch_only arch] [-sacLT] [-no_warning_for_no_symbols]
Usage: /Applications/Xcode6-Beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool -dynamic [-] file [...] [-filelist listfile[,dirname]] [-arch_only arch] [-o output] [-install_name name] [-compatibility_version #] [-current_version #] [-seg1addr 0x#] [-segs_read_only_addr 0x#] [-segs_read_write_addr 0x#] [-seg_addr_table <filename>] [-seg_addr_table_filename <file_system_path>] [-all_load] [-noall_load]
More Information
For those that are interested, or if you need more details, the project in question is on GitHub. I'm keeping track of what I've tried so far using this issue.
How can I distribute this Swift/Objective-C code (which uses XCTest code) to users who wish to use it in their iOS unit tests?
What is the value of FRAMEWORK_SEARCH_PATHS in your project? I just created a fresh iOS framework and this was the default:
$(inherited) $(DEVELOPER_FRAMEWORKS_DIR)
Try this instead:
$(SDKROOT)/Developer/Library/Frameworks $(inherited) $(DEVELOPER_FRAMEWORKS_DIR)
This should cause Xcode to find the iOS framework bundle before the Mac version.

libtool failed with exit code 1 in Xcode 4.2

I compile my project, it shows this error:
Libtool /Users/trinstanchen/Library/Developer/Xcode/DerivedData/iOSSocial-dedmezxegpbuqnfkhmbfrvtphyas/Build/Products/Debug-iphonesimulator/libiOSSocial.a normal i386
cd "/Users/trinstanchen/Downloads/iOSSocial-develop copy/iOSSocial"
setenv IPHONEOS_DEPLOYMENT_TARGET 5.0
setenv PATH "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool -static -arch_only i386 -syslibroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator6.0.sdk -L/Users/trinstanchen/Library/Developer/Xcode/DerivedData/iOSSocial-dedmezxegpbuqnfkhmbfrvtphyas/Build/Products/Debug-iphonesimulator -filelist /Users/trinstanchen/Library/Developer/Xcode/DerivedData/iOSSocial-dedmezxegpbuqnfkhmbfrvtphyas/Build/Intermediates/iOSSocial.build/Debug-iphonesimulator/iOSSocial.build/Objects-normal/i386/iOSSocial.LinkFileList -ObjC -fno-objc-arc -framework CoreGraphics -framework SenTestingKit -framework UIKit -framework Foundation -o /Users/trinstanchen/Library/Developer/Xcode/DerivedData/iOSSocial-dedmezxegpbuqnfkhmbfrvtphyas/Build/Products/Debug-iphonesimulator/libiOSSocial.a
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool: unknown option character `f' in: -fno-objc-arc
Usage: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool -static [-] file [...] [-filelist listfile[,dirname]] [-arch_only arch] [-sacLT]
Usage: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool -dynamic [-] file [...] [-filelist listfile[,dirname]] [-arch_only arch] [-o output] [-install_name name] [-compatibility_version #] [-current_version #] [-seg1addr 0x#] [-segs_read_only_addr 0x#] [-segs_read_write_addr 0x#] [-seg_addr_table ] [-seg_addr_table_filename ] [-all_load] [-noall_load]
Command /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool failed with exit code 1
can anyone give me help?

Resources