Installing the segment-iOS analytics-iOS in xcode manually - ios

I am trying to add analytics-iOS manually by directly adding the Analytics folder to the project making it as a group, after adding when I try to build the project I get error as "Undefined symbols for architecture x86_64:
"_OBJC_CLASS_$_SKProductsRequest", referenced from:
objc-class-ref in SEGStoreKitTracker.o
"_OBJC_CLASS_$_SKPaymentQueue", referenced from:
objc-class-ref in SEGStoreKitTracker.o "
and other 6 errors

I was able to solve this. There was a dependency on StoreKit framework which i had to add in Link Binaries with Libraries in Build Phase.

Related

MSAL iOS build with Carthage - linker error

I'm following the instructions here (https://github.com/AzureAD/microsoft-authentication-library-for-objc) to add the MSAL library to my (new) project. I'm using Xcode 10.1. I have a Cartfile with just one entry for MSAL. When running Carthage update --platform iOS I get a linker error (lots of them actually):
Undefined symbols for architecture armv7s:
"_MSID_DEFAULT_FAMILY_ID", referenced from:
-[MSALAccountsProvider accountForHomeAccountId:error:] in MSALAccountsProvider.o
-[MSALAccountsProvider accountForUsername:error:] in MSALAccountsProvider.o
-[MSALAccountsProvider allAccountsForAuthority:error:] in MSALAccountsProvider.o
"_OBJC_CLASS_$_MSIDConfiguration", referenced from:
objc-class-ref in MSALAccountsProvider.o
"_OBJC_CLASS_$_MSIDTelemetryBaseEvent", referenced from:
_OBJC_CLASS_$_MSALTelemetryDefaultEvent in MSALTelemetryDefaultEvent.o
"_OBJC_CLASS_$_MSIDAADV2IdTokenClaims", referenced from:
objc-class-ref in MSALResult.o
And so on - many such symbols.
Interesting the macOS one builds for me, even though on Github MSAL says macOS is not supported :)
Any help is greatly appreciated!

Undefined symbols for architecture x86_64 in Xcode 8.3.3 for iOS app

I have just created a new project in Xcode 8.3.3 with Swift for iOS and
I tried importing the external library SwiftLibModbus
I have ported the library to use Swift 3 (meaning, I fixed all the errors).
This library is using another library named libmodbus that is written in C and I am getting an Undefined symbols for architecture x86_64 error when this library is imported.
Here is the full error:
Undefined symbols for architecture x86_64:
"_modbus_free", referenced from:
__TFC23SomeProject_Wi_Fi_Connect14SwiftLibModbusD in SwiftLibModbus.o
"_modbus_strerror", referenced from:
__TFC23SomeProject_Wi_Fi_Connect14SwiftLibModbusP33_56F751289226F31D555D5DEEC0F0514F12buildNSErrorfT5errnoVs5Int32_CSo7NSError in SwiftLibModbus.o
"_modbus_write_registers", referenced from:
__TFFC23SomeProject_Wi_Fi_Connect14SwiftLibModbus23writeRegistersFromAndOnFT7addressVs5Int3211numberArrayCSo7NSArray7successFT_T_7failureFCSo7NSErrorT__T_U_FT_T_ in SwiftLibModbus.o
"_modbus_read_input_registers", referenced from:
__TFFC23SomeProject_Wi_Fi_Connect14SwiftLibModbus22readInputRegistersFromFT12startAddressVs5Int325countS1_7successFGSaPs9AnyObject__T_7failureFCSo7NSErrorT__T_U_FT_T_ in SwiftLibModbus.o
"_modbus_write_register", referenced from:
__TFFC23SomeProject_Wi_Fi_Connect14SwiftLibModbus13writeRegisterFT7addressVs5Int325valueS1_7successFT_T_7failureFCSo7NSErrorT__T_U_FT_T_ in SwiftLibModbus.o
"_modbus_write_bit", referenced from:
__TFFC23SomeProject_Wi_Fi_Connect14SwiftLibModbus8writeBitFT7addressVs5Int326statusSb7successFT_T_7failureFCSo7NSErrorT__T_U_FT_T_ in SwiftLibModbus.o
"_modbus_new_tcp", referenced from:
__TFC23SomeProject_Wi_Fi_Connect14SwiftLibModbus8setupTCPfT9ipAddressCSo8NSString4portVs5Int326deviceS2__Sb in SwiftLibModbus.o
"_modbus_set_error_recovery", referenced from:
__TFC23SomeProject_Wi_Fi_Connect14SwiftLibModbus8setupTCPfT9ipAddressCSo8NSString4portVs5Int326deviceS2__Sb in SwiftLibModbus.o
"_modbus_close", referenced from:
__TFC23SomeProject_Wi_Fi_Connect14SwiftLibModbus10disconnectfT_T_ in SwiftLibModbus.o
"_modbus_connect", referenced from:
__TFC23SomeProject_Wi_Fi_Connect14SwiftLibModbus16connectWithErrorfCSo7NSErrorSb in SwiftLibModbus.o
__TFFC23SomeProject_Wi_Fi_Connect14SwiftLibModbus7connectFT7successFT_T_7failureFCSo7NSErrorT__T_U_FT_T_ in SwiftLibModbus.o
"_modbus_read_registers", referenced from:
__TFFC23SomeProject_Wi_Fi_Connect14SwiftLibModbus17readRegistersFromFT12startAddressVs5Int325countS1_7successFGSaPs9AnyObject__T_7failureFCSo7NSErrorT__T_U_FT_T_ in SwiftLibModbus.o
"_modbus_read_input_bits", referenced from:
__TFFC23SomeProject_Wi_Fi_Connect14SwiftLibModbus17readInputBitsFromFT12startAddressVs5Int325countS1_7successFGSaPs9AnyObject__T_7failureFCSo7NSErrorT__T_U_FT_T_ in SwiftLibModbus.o
"_modbus_read_bits", referenced from:
__TFFC23SomeProject_Wi_Fi_Connect14SwiftLibModbus12readBitsFromFT12startAddressVs5Int325countS1_7successFGSaPs9AnyObject__T_7failureFCSo7NSErrorT__T_U_FT_T_ in SwiftLibModbus.o
"_modbus_set_slave", referenced from:
__TFC23SomeProject_Wi_Fi_Connect14SwiftLibModbus8setupTCPfT9ipAddressCSo8NSString4portVs5Int326deviceS2__Sb in SwiftLibModbus.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Is there any way around this?
This is actually the only library I have found available for Modbus.
Thanks :)
Hmmm... Did you drag the files inside a folder using "Copy items if needed" and "Create folder references" marked?
If so, Xcode might not understand it needs to compile the files for the right architecture inside that folder.
Just drag the bunch of files directly to Xcode and it should be fine.
As pointed out somewhere else on SO, I've solved this one by:
renaming my projects and target which had an _ (underscore) in the name
rebuilding the pod with pod update
cleaning derived data File -> Workspace Settings -> Grey Arrow -> CMD + delete
closing and reopening workspace
creating a new test target from the <-> target menu
If you just drag all files to XCode, it builds C code for currently selected architecture, you may need to clean and build project to get library compiled for right architecture after changing target (device/simulator)
To avoid this, native libraries should be built with external script for all required architectures and merged in one "fat" or "universal" library.
check whether you have import your framework like
#import framework;
Mybe you had draged two library which is same to project, Xcode is confused about which one to use.just delete one,it will be ok.
If the library that gives these errors has a ".a" file, then you need to check that this file is added to Build Phases/Link Binary With Libraries.

CocoaPods AmazonMobileHub Undefined symbols for architecture x86_64

I have a cocoa pods Swift project and Im trying to install the Amazon AWS Mobile Hub frameworks, copied the Sdks and the MobileHubHelper framework but is not building.
The error goes like this:
Undefined symbols for architecture x86_64:
"_OBJC_CLASS_$_AWSLambdaInvoker", referenced from:
objc-class-ref in AWSMobileHubHelper(AWSCloudLogic.o)
"_OBJC_CLASS_$_AWSS3", referenced from:
objc-class-ref in AWSMobileHubHelper(AWSContentManager.o)
(maybe you meant: _OBJC_CLASS_$_AWSS3ContentProvider)
"_OBJC_CLASS_$_AWSS3GetPreSignedURLRequest", referenced from:
objc-class-ref in AWSMobileHubHelper(AWSContentManager.o)
"_OBJC_CLASS_$_AWSS3ListObjectsOutput", referenced from:
objc-class-ref in AWSMobileHubHelper(AWSContentManager.o)
"_OBJC_CLASS_$_AWSS3ListObjectsRequest", referenced from:
objc-class-ref in AWSMobileHubHelper(AWSContentManager.o)
From what I found it looks like it is not encourage to use the public SDKs with the mobile hub framework but to copy the ones given with the sample app but either way it does not work.
Any ideas will be appreciated.
Thanks!
Turns out that if you go to the Pods folder in your project and update the Pods-.debug.xcconfig and Pods-.release.xcconfig OTHER_LDFLAGS by removing the -ObjC param after ($inherited) the project builds and run.
Have you added $(inherited) to Other Linker Flags? Check by clicking on your project -> build settings -> type in the search bar: Other linker flags and expand Debug and on the right side where you'll see some paths, click on that and set it to $(inherited). Should work.

Apptentive: `Undefined symbols for architecture...` error in Cordova project

I'm trying to use Apptentive in Cordova project. While building my Xcode project I'm getting error:
Undefined symbols for architecture arm64:
"_CGImageSourceCreateWithURL", referenced from:
-[ATFileAttachment createThumbnailOfSize:] in libApptentiveConnect.a(ATFileAttachment.o)
"_kCGImageSourceCreateThumbnailWithTransform", referenced from:
-[ATFileAttachment createThumbnailOfSize:] in libApptentiveConnect.a(ATFileAttachment.o)
"_kCGImageSourceThumbnailMaxPixelSize", referenced from:
-[ATFileAttachment createThumbnailOfSize:] in libApptentiveConnect.a(ATFileAttachment.o)
"_OBJC_CLASS_$_QLPreviewController", referenced from:
objc-class-ref in libApptentiveConnect.a(ATAttachmentController.o)
objc-class-ref in libApptentiveConnect.a(ATMessageCenterViewController.o)
"_kCGImageSourceCreateThumbnailFromImageAlways", referenced from:
-[ATFileAttachment createThumbnailOfSize:] in libApptentiveConnect.a(ATFileAttachment.o)
"_CGImageSourceCreateThumbnailAtIndex", referenced from:
-[ATFileAttachment createThumbnailOfSize:] in libApptentiveConnect.a(ATFileAttachment.o)
"_CGImageSourceCopyTypeIdentifiers", referenced from:
___50+[ATFileAttachment canCreateThumbnailForMIMEType:]_block_invoke in libApptentiveConnect.a(ATFileAttachment.o)
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
There is a similar question on StackOverflow, but the solution didn't work for me :/
Looks like I have all the required dependencies, also I've added -lApptentiveConnect flag for linker.
Frameworks
It looks like there are some required system frameworks that aren't being linked automatically.
You need to link against AVFoundation, CoreData, CoreGraphics, Foundation, ImageIO, MobileCoreServices, QuartzCore, SystemConfiguration, UIKit and weak link StoreKit and CoreTelephony.
Step by step:
Select your project in the project navigator in Xcode.
Select your target from the list of targets.
Select the Build Phases tab.
Expand the Link Binary with Libraries group.
Click the + Button and select the aforementioned frameworks (including the two weak-linked ones). You can ⌘-click to select more than one.
When you're back at the list of libraries, select "Optional" for the two weak-linked frameworks.
You should then be able to build and run successfully.

Issues updating Phonegap iOS app for 64-bit architecture

I have a phonegap app with many plugins that runs fine on iOS devices. However, I am currently using $(ARCHS_STANDARD_32_BIT) for architectures in xcode, and now believe I need to update it to be $(ARCHS_STANDARD) in the architecture setting and to include arm64 as a valid architecture per Apple's Feb 1, 2015 requirements.
When I try to run the project on an iPhone 6, I get 16 errors now, copied below. 2 questions:
1) Do I need to use the archs_standard and arm64 changes mentioned in the 1st paragraph?
2) How do I fix these issues so I can submit my app? Is it all issues with individual plugins I'm using? Do I need to find an updated version (or update myself) every plugin listed in the errors or is the issue related to something else? I don't see updates for 64-bit on a few of the plugins I've looked at, so not sure if this is what the issue is. I'm not very familiar with Obj C so appreciate any help here!
Thanks in advance for any help!
Error messages:
Undefined symbols for architecture arm64:
"_CDVPageDidLoadNotification", referenced from:
-[CDVSplashScreen pluginInitialize] in CDVSplashScreen.o
"_OBJC_CLASS_$_CDVInvokedUrlCommand", referenced from:
objc-class-ref in CDVFile.o
"_OBJC_METACLASS_$_CDVCommandQueue", referenced from:
_OBJC_METACLASS_$_MainCommandQueue in MainViewController.o
"_OBJC_CLASS_$_CDVPlugin", referenced from:
_OBJC_CLASS_$_CDVLocation in CDVLocation.o
_OBJC_CLASS_$_FacebookConnectPlugin in FacebookConnectPlugin.o
_OBJC_CLASS_$_IonicKeyboard in IonicKeyboard.o
_OBJC_CLASS_$_CDVInAppBrowser in CDVInAppBrowser.o
_OBJC_CLASS_$_APPEmailComposer in APPEmailComposer.o
_OBJC_CLASS_$_CDVStatusBar in CDVStatusBar.o
_OBJC_CLASS_$_CDVVibration in CDVVibration.o
...
"_OBJC_METACLASS_$_CDVViewController", referenced from:
_OBJC_METACLASS_$_MainViewController in MainViewController.o
"_CDVLocalNotification", referenced from:
-[AppDelegate application:didReceiveLocalNotification:] in AppDelegate.o
"_OBJC_CLASS_$_CDVViewController", referenced from:
l_OBJC_$_CATEGORY_CDVViewController_$_StatusBar in CDVStatusBar.o
_OBJC_CLASS_$_MainViewController in MainViewController.o
objc-class-ref in CDVFile.o
"_OBJC_METACLASS_$_CDVCommandDelegateImpl", referenced from:
_OBJC_METACLASS_$_MainCommandDelegate in MainViewController.o
"_OBJC_CLASS_$_CDVWebViewDelegate", referenced from:
objc-class-ref in CDVInAppBrowser.o
"_OBJC_CLASS_$_CDVCommandQueue", referenced from:
_OBJC_CLASS_$_MainCommandQueue in MainViewController.o
"_OBJC_CLASS_$_CDVUserAgentUtil", referenced from:
objc-class-ref in CDVInAppBrowser.o
"_CDVPluginHandleOpenURLNotification", referenced from:
-[AppDelegate application:handleOpenURL:] in AppDelegate.o
-[CDVInAppBrowser openInSystem:] in CDVInAppBrowser.o
"_OBJC_CLASS_$_CDVCommandDelegateImpl", referenced from:
_OBJC_CLASS_$_MainCommandDelegate in MainViewController.o
"_OBJC_CLASS_$_CDVPluginResult", referenced from:
objc-class-ref in CDVLocation.o
objc-class-ref in FacebookConnectPlugin.o
objc-class-ref in CDVInAppBrowser.o
objc-class-ref in APPEmailComposer.o
objc-class-ref in CDVStatusBar.o
objc-class-ref in CDVLocalFilesystem.o
objc-class-ref in PushPlugin.o
...
"_OBJC_METACLASS_$_CDVPlugin", referenced from:
_OBJC_METACLASS_$_CDVLocation in CDVLocation.o
_OBJC_METACLASS_$_FacebookConnectPlugin in FacebookConnectPlugin.o
_OBJC_METACLASS_$_IonicKeyboard in IonicKeyboard.o
_OBJC_METACLASS_$_CDVInAppBrowser in CDVInAppBrowser.o
_OBJC_METACLASS_$_APPEmailComposer in APPEmailComposer.o
_OBJC_METACLASS_$_CDVStatusBar in CDVStatusBar.o
_OBJC_METACLASS_$_CDVVibration in CDVVibration.o
...
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
1) Do I need to use the archs_standard and arm64 changes mentioned in
the 1st paragraph?
Yes, you have to use $(ARCHS_STANDARD) and arm64 if you want to submit the app to the stores.
2) How do I fix these issues so I can submit my app? Is it all issues
with individual plugins I'm using? Do I need to find an updated
version (or update myself) every plugin listed in the errors or is the
issue related to something else? I don't see updates for 64-bit on a
few of the plugins I've looked at, so not sure if this is what the
issue is. I'm not very familiar with Obj C so appreciate any help
here!
The plugins are fine, the problem is the cordovaLib project. You have to change the cordovaLib project to $(ARCHS_STANDARD) too and rebuild the libCordova.a, or even better, use a cordova version greater than 3.4 that will include the 64 bits support.
EDIT:
More details from the link manihiki provided:
You will need to update the Build Settings in your project. The steps are mentioned in the issue and reproduced below:
//Update build settings for your project
Select your Project icon Choose Build Settings.
For “Architectures”, select $ARCHS_STANDARD – Standard architectures (armv7, armv7s, arm64)
For “Valid Architectures”, add “arm64″
//Update build settings for cordovaLib project
Select your CordovaLib.xcodeproj icon
In the Build Settings for the Project (not Target), delete *all* the conditional architecture settings (hover to see the minus sign). This is what is recommended by Apple in their Xcode 5.1 Release Notes.
For “Architectures”, select $ARCHS_STANDARD – Standard architectures(armv7, armv7s, arm64)
For “Valid Architectures”, add “arm64″
//Update build settings for the Target
In the Build Settings for the Target, delete *all* the conditional architecture settings (hover to see the minus sign).
For “Architectures”, select $ARCHS_STANDARD – Standard architectures (armv7, armv7s, arm64)
For “Valid Architectures”, add “arm64″
Some plugins might not work, you have to made this changes
On CordovaLib/Classes/CDVCommandQueue.m
change this
objc_msgSend(obj, normalSelector, command);
to this
((void (*)(id, SEL, id))objc_msgSend)(obj, normalSelector, command);
and on CordovaLib/Classes/CDVViewController.m
change this
if ((BOOL)objc_msgSend(plugin, selector, request, navigationType) == YES)
to this:
if (((BOOL (*)(id, SEL, id, int))objc_msgSend)(plugin, selector, request, navigationType) == YES)
All the details can be found here https://shazronatadobe.wordpress.com/2014/03/12/xcode-5-1-and-cordova-ios/
I inherited a legacy PhoneGap/Cordova app and received many similar errors when changing the Architecture Build Setting to $(ARCHS_STANDARD).
I was able to successfully build after updating (removing and then adding) two PhoneGap plugins (out of nine total), and removing/adding the PhoneGap iOS platform each time. Specifically, the plugins were com.phonegap.plugins.barcodescanner and org.apache.cordova.geolocation. I targeted those two plugins by googling the classnames in the errors and determining which plugins they related to.
To "update" a plugin:
cordova plugin rm com.phonegap.plugins.barcodescanner
cordova plugin add com.phonegap.plugins.barcodescanner
To remove/add the PhoneGap/Cordova ios platform:
cordova platform remove ios
cordova platform add ios

Resources