Building iOS plugin

I am trying to create a plugin for a barcode scanner that connects to the iPhone.

I copied the Project Template and experimented with the tutorial and successfully made some changes to the sample app.

My problem is when I add the .a library file that the barcode scanner provides I am getting link errors.  I added it to the Plugin.xcodeproj and it builds successfully but when I open up the App.xcodeproj and build I get the following error:

 

Showing All Messages

PhaseScriptExecution Corona\ Native /Users/laurabangerter/Library/Developer/Xcode/DerivedData/App-fjokpsneskdgljcdyzypbtptpxlz/Build/Intermediates.noindex/App.build/Debug-iphoneos/App.build/Script-C28A3B451EE9F8FD00F08609.sh

    cd “/Users/laurabangerter/Documents/asBarcodeScannerPlugin/Project Template/App/ios”

    /bin/sh -c /Users/laurabangerter/Library/Developer/Xcode/DerivedData/App-fjokpsneskdgljcdyzypbtptpxlz/Build/Intermediates.noindex/App.build/Debug-iphoneos/App.build/Script-C28A3B451EE9F8FD00F08609.sh

 

Building with Corona Native from /Applications/Corona-3311/Native/

 

Ld /Users/laurabangerter/Library/Developer/Xcode/DerivedData/App-fjokpsneskdgljcdyzypbtptpxlz/Build/Products/Debug-iphoneos/App.app/App normal armv7

    cd “/Users/laurabangerter/Documents/asBarcodeScannerPlugin/Project Template/App/ios”

    export IPHONEOS_DEPLOYMENT_TARGET=10.0

    export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"

    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -arch armv7 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.4.sdk -L/Users/laurabangerter/Library/Developer/Xcode/DerivedData/App-fjokpsneskdgljcdyzypbtptpxlz/Build/Products/Debug-iphoneos -L/Users/laurabangerter/Documents/asBarcodeScannerPlugin/Project\ Template/App/ios -L/Users/laurabangerter/Library/Application\ Support/Corona/Native/Corona/ios/lib -L/Users/laurabangerter/Documents/asBarcodeScannerPlugin/Project\ Template/App/ios/RcpLib -F/Users/laurabangerter/Library/Developer/Xcode/DerivedData/App-fjokpsneskdgljcdyzypbtptpxlz/Build/Products/Debug-iphoneos -F/Users/laurabangerter/Documents/asBarcodeScannerPlugin/Project\ Template/App/ios/EmbeddedFrameworks -filelist /Users/laurabangerter/Library/Developer/Xcode/DerivedData/App-fjokpsneskdgljcdyzypbtptpxlz/Build/Intermediates.noindex/App.build/Debug-iphoneos/App.build/Objects-normal/armv7/App.LinkFileList -miphoneos-version-min=10.0 -Xlinker -object_path_lto -Xlinker /Users/laurabangerter/Library/Developer/Xcode/DerivedData/App-fjokpsneskdgljcdyzypbtptpxlz/Build/Intermediates.noindex/App.build/Debug-iphoneos/App.build/Objects-normal/armv7/App_lto.o -Xlinker -export_dynamic -Xlinker -no_deduplicate -stdlib=libc++ -fobjc-link-runtime -all_load -ObjC -all_load -lplayer /Users/laurabangerter/Library/Developer/Xcode/DerivedData/App-fjokpsneskdgljcdyzypbtptpxlz/Build/Products/Debug-iphoneos/libplugin_library.a -weak_framework Photos -weak_framework AssetsLibrary -framework CoreText -framework CoreVideo -framework GLKit -weak_framework Accounts -weak_framework Social -framework AddressBook -framework AddressBookUI -framework AudioToolbox -framework AVFoundation -framework CFNetwork -framework CoreGraphics -framework CoreLocation -framework CoreMedia -framework CoreMotion -framework Foundation -framework GameKit -weak_framework GameController -framework ImageIO -lobjc -lsqlite3 -framework MapKit -framework MediaPlayer -framework MessageUI -framework MobileCoreServices -framework OpenAL -framework OpenGLES -framework QuartzCore -framework Security -framework StoreKit -framework SystemConfiguration -weak_framework Twitter -framework UIKit -Xlinker -dependency_info -Xlinker /Users/laurabangerter/Library/Developer/Xcode/DerivedData/App-fjokpsneskdgljcdyzypbtptpxlz/Build/Intermediates.noindex/App.build/Debug-iphoneos/App.build/Objects-normal/armv7/App_dependency_info.dat -o /Users/laurabangerter/Library/Developer/Xcode/DerivedData/App-fjokpsneskdgljcdyzypbtptpxlz/Build/Products/Debug-iphoneos/App.app/App

 

Undefined symbols for architecture armv7:

  “_EAAccessoryDidConnectNotification”, referenced from:

      -[Eas initWithProtocol:initProtocolSize:] in libplugin_library.a(Eas.o)

  “_OBJC_CLASS_$_EAAccessoryManager”, referenced from:

      objc-class-ref in libplugin_library.a(RcpRfidApi.o)

      objc-class-ref in libplugin_library.a(RcpBarcodeApi.o)

      objc-class-ref in libplugin_library.a(UartMgr.o)

      objc-class-ref in libplugin_library.a(Eas.o)

  “_OBJC_CLASS_$_EASession”, referenced from:

      objc-class-ref in libplugin_library.a(Eas.o)

ld: symbol(s) not found for architecture armv7

clang: error: linker command failed with exit code 1 (use -v to see invocation)

 

I have searched and searched and have tried changing various flags for Deadcode stripping, other linker flags, and library search paths.  

If I create a blank brand new xcode project and add the library and headers it builds fine.

Any ideas?

Thanks

-Laura

If I add the library and header files to the App.xcodeconfig proj vs the plugin proj.  I get the following error:

 

Showing All Messages

Ld /Users/laurabangerter/Library/Developer/Xcode/DerivedData/App-fjokpsneskdgljcdyzypbtptpxlz/Build/Products/Debug-iphoneos/App.app/App normal arm64

    cd “/Users/laurabangerter/Documents/asBarcodeScannerPlugin/Project Template/App/ios”

    export IPHONEOS_DEPLOYMENT_TARGET=10.0

    export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"

    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -arch arm64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.4.sdk -L/Users/laurabangerter/Library/Developer/Xcode/DerivedData/App-fjokpsneskdgljcdyzypbtptpxlz/Build/Products/Debug-iphoneos -L/Users/laurabangerter/Documents/asBarcodeScannerPlugin/Project\ Template/App/ios -L/Users/laurabangerter/Library/Application\ Support/Corona/Native/Corona/ios/lib -L/Users/laurabangerter/Documents/asBarcodeScannerPlugin/Project\ Template/App/ios/RcpLib -F/Users/laurabangerter/Library/Developer/Xcode/DerivedData/App-fjokpsneskdgljcdyzypbtptpxlz/Build/Products/Debug-iphoneos -F/Users/laurabangerter/Documents/asBarcodeScannerPlugin/Project\ Template/App/ios/EmbeddedFrameworks -filelist /Users/laurabangerter/Library/Developer/Xcode/DerivedData/App-fjokpsneskdgljcdyzypbtptpxlz/Build/Intermediates.noindex/App.build/Debug-iphoneos/App.build/Objects-normal/arm64/App.LinkFileList -miphoneos-version-min=10.0 -Xlinker -object_path_lto -Xlinker /Users/laurabangerter/Library/Developer/Xcode/DerivedData/App-fjokpsneskdgljcdyzypbtptpxlz/Build/Intermediates.noindex/App.build/Debug-iphoneos/App.build/Objects-normal/arm64/App_lto.o -Xlinker -export_dynamic -Xlinker -no_deduplicate -stdlib=libc++ -fobjc-link-runtime -all_load -ObjC -all_load -lplayer /Users/laurabangerter/Library/Developer/Xcode/DerivedData/App-fjokpsneskdgljcdyzypbtptpxlz/Build/Products/Debug-iphoneos/libplugin_library.a -weak_framework Photos -weak_framework AssetsLibrary -framework CoreText -lAreteUart -framework CoreVideo -framework GLKit -weak_framework Accounts -weak_framework Social -framework AddressBook -framework AddressBookUI -framework AudioToolbox -framework AVFoundation -framework CFNetwork -framework CoreGraphics -framework CoreLocation -framework CoreMedia -framework CoreMotion -lAreteUart -framework Foundation -framework GameKit -weak_framework GameController -framework ImageIO -lobjc -lsqlite3 -framework MapKit -framework MediaPlayer -framework MessageUI -framework MobileCoreServices -framework OpenAL -framework OpenGLES -framework QuartzCore -framework Security -framework StoreKit -framework SystemConfiguration -weak_framework Twitter -framework UIKit -Xlinker -dependency_info -Xlinker /Users/laurabangerter/Library/Developer/Xcode/DerivedData/App-fjokpsneskdgljcdyzypbtptpxlz/Build/Intermediates.noindex/App.build/Debug-iphoneos/App.build/Objects-normal/arm64/App_dependency_info.dat -o /Users/laurabangerter/Library/Developer/Xcode/DerivedData/App-fjokpsneskdgljcdyzypbtptpxlz/Build/Products/Debug-iphoneos/App.app/App

 

Undefined symbols for architecture arm64:

  “_EAAccessoryDidConnectNotification”, referenced from:

      -[Eas initWithProtocol:initProtocolSize:] in libAreteUart.a(Eas.o)

  “_OBJC_CLASS_$_EAAccessoryManager”, referenced from:

      objc-class-ref in libAreteUart.a(RcpRfidApi.o)

      objc-class-ref in libAreteUart.a(RcpBarcodeApi.o)

      objc-class-ref in libAreteUart.a(UartMgr.o)

      objc-class-ref in libAreteUart.a(Eas.o)

  “_OBJC_CLASS_$_EASession”, referenced from:

      objc-class-ref in libAreteUart.a(Eas.o)

ld: symbol(s) not found for architecture arm64

clang: error: linker command failed with exit code 1 (use -v to see invocation)

 

For future reference I fixed it by adding an ExternalAccessory.framework reference to the project.

“_OBJC_CLASS_$_EASession”, referenced from: error. It was fixed by adding ExternalAccessory.framework to Targets > myApp > Build Phases > Link Binary with Libraries

If I add the library and header files to the App.xcodeconfig proj vs the plugin proj.  I get the following error:

 

Showing All Messages

Ld /Users/laurabangerter/Library/Developer/Xcode/DerivedData/App-fjokpsneskdgljcdyzypbtptpxlz/Build/Products/Debug-iphoneos/App.app/App normal arm64

    cd “/Users/laurabangerter/Documents/asBarcodeScannerPlugin/Project Template/App/ios”

    export IPHONEOS_DEPLOYMENT_TARGET=10.0

    export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"

    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -arch arm64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.4.sdk -L/Users/laurabangerter/Library/Developer/Xcode/DerivedData/App-fjokpsneskdgljcdyzypbtptpxlz/Build/Products/Debug-iphoneos -L/Users/laurabangerter/Documents/asBarcodeScannerPlugin/Project\ Template/App/ios -L/Users/laurabangerter/Library/Application\ Support/Corona/Native/Corona/ios/lib -L/Users/laurabangerter/Documents/asBarcodeScannerPlugin/Project\ Template/App/ios/RcpLib -F/Users/laurabangerter/Library/Developer/Xcode/DerivedData/App-fjokpsneskdgljcdyzypbtptpxlz/Build/Products/Debug-iphoneos -F/Users/laurabangerter/Documents/asBarcodeScannerPlugin/Project\ Template/App/ios/EmbeddedFrameworks -filelist /Users/laurabangerter/Library/Developer/Xcode/DerivedData/App-fjokpsneskdgljcdyzypbtptpxlz/Build/Intermediates.noindex/App.build/Debug-iphoneos/App.build/Objects-normal/arm64/App.LinkFileList -miphoneos-version-min=10.0 -Xlinker -object_path_lto -Xlinker /Users/laurabangerter/Library/Developer/Xcode/DerivedData/App-fjokpsneskdgljcdyzypbtptpxlz/Build/Intermediates.noindex/App.build/Debug-iphoneos/App.build/Objects-normal/arm64/App_lto.o -Xlinker -export_dynamic -Xlinker -no_deduplicate -stdlib=libc++ -fobjc-link-runtime -all_load -ObjC -all_load -lplayer /Users/laurabangerter/Library/Developer/Xcode/DerivedData/App-fjokpsneskdgljcdyzypbtptpxlz/Build/Products/Debug-iphoneos/libplugin_library.a -weak_framework Photos -weak_framework AssetsLibrary -framework CoreText -lAreteUart -framework CoreVideo -framework GLKit -weak_framework Accounts -weak_framework Social -framework AddressBook -framework AddressBookUI -framework AudioToolbox -framework AVFoundation -framework CFNetwork -framework CoreGraphics -framework CoreLocation -framework CoreMedia -framework CoreMotion -lAreteUart -framework Foundation -framework GameKit -weak_framework GameController -framework ImageIO -lobjc -lsqlite3 -framework MapKit -framework MediaPlayer -framework MessageUI -framework MobileCoreServices -framework OpenAL -framework OpenGLES -framework QuartzCore -framework Security -framework StoreKit -framework SystemConfiguration -weak_framework Twitter -framework UIKit -Xlinker -dependency_info -Xlinker /Users/laurabangerter/Library/Developer/Xcode/DerivedData/App-fjokpsneskdgljcdyzypbtptpxlz/Build/Intermediates.noindex/App.build/Debug-iphoneos/App.build/Objects-normal/arm64/App_dependency_info.dat -o /Users/laurabangerter/Library/Developer/Xcode/DerivedData/App-fjokpsneskdgljcdyzypbtptpxlz/Build/Products/Debug-iphoneos/App.app/App

 

Undefined symbols for architecture arm64:

  “_EAAccessoryDidConnectNotification”, referenced from:

      -[Eas initWithProtocol:initProtocolSize:] in libAreteUart.a(Eas.o)

  “_OBJC_CLASS_$_EAAccessoryManager”, referenced from:

      objc-class-ref in libAreteUart.a(RcpRfidApi.o)

      objc-class-ref in libAreteUart.a(RcpBarcodeApi.o)

      objc-class-ref in libAreteUart.a(UartMgr.o)

      objc-class-ref in libAreteUart.a(Eas.o)

  “_OBJC_CLASS_$_EASession”, referenced from:

      objc-class-ref in libAreteUart.a(Eas.o)

ld: symbol(s) not found for architecture arm64

clang: error: linker command failed with exit code 1 (use -v to see invocation)

 

For future reference I fixed it by adding an ExternalAccessory.framework reference to the project.

“_OBJC_CLASS_$_EASession”, referenced from: error. It was fixed by adding ExternalAccessory.framework to Targets > myApp > Build Phases > Link Binary with Libraries