Description
I need some help with including a framework in an iOS module.
The framework was added using the steps described in the guide here:
http://docs.appcelerator.com/titanium/latest/#!/guide/iOS_Module_Development_Guide-section-29004946_iOSModuleDevelopmentGuide-AddingSpecialCompilerDirectives
The "Other Link Flags" added via XCode are -ObjC -all_load -framework StarIO
When building a project with the module, we get the following linker error:
[TRACE] : Ld build/Debug-iphonesimulator/testStarPrinter.app/testStarPrinter normal i386
[TRACE] : cd /Users/btran/Desktop/temp/testStarPrinter/build/iphone
[TRACE] : setenv IPHONEOS_DEPLOYMENT_TARGET 5.0
[TRACE] : setenv PATH "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:/usr/local/lib/node_modules:/usr/bin:/usr/local/bin:/bin:/usr/local/lib/node_modules:/Applications/android-sdk-macosx/platform-tools:/Applications/android-sdk-macosx/tools:/Applications/android-ndk:/Applications/android-sdk-macosx:/user/local/titanium:/Users/btran/Downloads/ImageAlpha.app/Contents/Resources"
[TRACE] : /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -arch i386 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator6.0.sdk -L/Users/btran/Desktop/temp/testStarPrinter/build/iphone/build/Debug-iphonesimulator -L/Users/btran/Desktop/temp/testStarPrinter/build/iphone/lib -L/Users/btran/Desktop/temp/testStarPrinter/modules/iphone/com.appcelerator.test.star/0.1 -F/Users/btran/Desktop/temp/testStarPrinter/build/iphone/build/Debug-iphonesimulator -filelist /Users/btran/Desktop/temp/testStarPrinter/build/iphone/build/testStarPrinter.build/Debug-iphonesimulator/testStarPrinter.build/Objects-normal/i386/testStarPrinter.LinkFileList -Xlinker -objc_abi_version -Xlinker 2 -ObjC -weak_framework iAd -weak_framework iAd -fobjc-link-runtime -Xlinker -no_implicit_dylibs -mios-simulator-version-min=5.0 -framework EventKit -framework EventKitUI -weak_framework Security -licucore -framework Foundation -weak_framework UIKit -framework CoreGraphics -weak_framework AddressBook -framework AddressBookUI -framework CFNetwork -framework CoreLocation -framework MapKit -framework MessageUI -framework MobileCoreServices -framework OpenGLES -framework QuartzCore -framework SystemConfiguration -lsqlite3 -lz -framework AudioToolbox -weak_framework MediaPlayer -framework AVFoundation -lxml2 -framework StoreKit -lTiCore -lcom.appcelerator.test.star -framework ExternalAccessory -ltiverify -lti_ios_debugger -lti_ios_profiler -o /Users/btran/Desktop/temp/testStarPrinter/build/iphone/build/Debug-iphonesimulator/testStarPrinter.app/testStarPrinter
[TRACE] : Undefined symbols for architecture i386:
[TRACE] : "_OBJC_CLASS_$_AsyncSocket", referenced from:
[TRACE] : objc-class-ref in libti_ios_debugger.a(TiDebugger.o)
[TRACE] : ld: symbol(s) not found for architecture i386
[TRACE] : clang: error: linker command failed with exit code 1 (use -v to see invocation)
[ERROR] : ** BUILD FAILED **
[ERROR] : The following build commands failed:
[ERROR] : Ld build/Debug-iphonesimulator/testStarPrinter.app/testStarPrinter normal i386
[ERROR] : (1 failure)
Please find attached the module source and a test project. Not sure if this is a bug or a code issue.
For reference, here is a link to the framework:
http://www.starmicronics.com/support/SDKDocumentation.aspx
[~btran] Please include a repro case and steps to reproduce this issue.
This is closed resolved after we had a call with the customer (brought Jon Alter into the call) to help.
Resolution:
1.CommonEnum.h
,MiniPrinterFunctions.h
, andMiniPrinterFunctions.m
need to be added to the module's Xcode project. They are in theClasses
folder, but they will not get compiled if they are not added to the project. To do this, open the module's Xcode project with Xcode, grab the files in Finder and drag them into the 'Classes' folder in the Xcode project. 2. The application project needs to be able to find theStarIO
framework at build time. a. In Finder, move theStarIO.framework
from the root of the module into theplatform
folder in the module. This will package the framework with the module when it is built. b. In the module's Xcode project, remove the framework (it will now show up as red) and re-add it in its new location c. In themodule.xcconfig
file add FRAMEWORK_SEARCH_PATHS as seen below. This will allow the application to find the framework. Note: Be sure to change the module's version number in these paths whenever the module version is changed. FRAMEWORK_SEARCH_PATHS=$(SRCROOT)/../../modules/iphone/starprinter.com/1/platform /Library/Application\ Support/Titanium/modules/iphone/starprinter.com/1/platform ~/Library/Application\ Support/Titanium/modules/iphone/starprinter.com/1/platform OTHER_LDFLAGS=$(inherited) -framework ExternalAccessory -framework StarIO -frameworkFoundationI think I might have a path forward without having to do anything too radical... details forthcoming after some more tests
Sorry, commented on the wrong ticket