Parse for iOS: Errors when trying to run the app - ios

I've been working with the Parse SDK and I followed the quickstep guide. When I try to run, I get these 8 errors. Any ideas as to why? It looks like something to do with the Facebook part of Parse which I'm not using.
Undefined symbols for architecture armv7:
"_FBTokenInformationTokenKey", referenced from:
-[PFFacebookTokenCachingStrategy accessToken] in Parse(PFFacebookTokenCachingStrategy.o)
-[PFFacebookTokenCachingStrategy setAccessToken:] in Parse(PFFacebookTokenCachingStrategy.o)
"_FBTokenInformationExpirationDateKey", referenced from:
-[PFFacebookTokenCachingStrategy cacheTokenInformation:] in Parse(PFFacebookTokenCachingStrategy.o)
-[PFFacebookTokenCachingStrategy expirationDate] in Parse(PFFacebookTokenCachingStrategy.o)
-[PFFacebookTokenCachingStrategy setExpirationDate:] in Parse(PFFacebookTokenCachingStrategy.o)
"_OBJC_METACLASS_$_FBSessionTokenCachingStrategy", referenced from:
_OBJC_METACLASS_$_PFFacebookTokenCachingStrategy in Parse(PFFacebookTokenCachingStrategy.o)
"_OBJC_CLASS_$_FBSessionTokenCachingStrategy", referenced from:
_OBJC_CLASS_$_PFFacebookTokenCachingStrategy in Parse(PFFacebookTokenCachingStrategy.o)
"_FBTokenInformationUserFBIDKey", referenced from:
-[PFFacebookTokenCachingStrategy facebookId] in Parse(PFFacebookTokenCachingStrategy.o)
-[PFFacebookTokenCachingStrategy setFacebookId:] in Parse(PFFacebookTokenCachingStrategy.o)
"_OBJC_CLASS_$_FBRequest", referenced from:
objc-class-ref in Parse(PFFacebookAuthenticationProvider.o)
"_OBJC_CLASS_$_FBSession", referenced from:
objc-class-ref in Parse(PFFacebookAuthenticationProvider.o)
ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)

This is some sort of bug associated with the Parse iOS 1.1.33 release as multiple people are seeing the same errors- myself included.
There are a couple of workarounds-
If you're not using a library which requires the -ObjC linker flag, you can remove -ObjC from your project:
Build Settings > Other Linker Flags > remove -ObjC
or if you are using a library which requires that flag, you can add the Facebook SDK.
Both options will eliminate the errors. Hopefully they fix this as I have no need for the Facebook SDK in my app.
Follow the discussion here:
https://parse.com/questions/cocoapods-incompatibility

Here's a potentially simpler workaround than downloading, compiling, and installing the FB kit which is kind of large and cumbersome. Note that, of course, you won't be able to use any of the FB type functionality in Parse and you will run into severe issues if you trigger any of the Parse code that is expecting to use these dummy symbols. But, if you stay away from them you'll be OK I think. So...
Create an object in your application called FBMissingSymbols
Delete the .h you won't need it
Put this in the .m :
NSString *FBTokenInformationExpirationDateKey = #"";
NSString *FBTokenInformationTokenKey = #"";
NSString *FBTokenInformationUserFBIDKey = #"";
#interface FBAppCall:NSObject
#end
#implementation FBAppCall
#end
#interface FBRequest:NSObject
#end
#implementation FBRequest
#end
#interface FBSession:NSObject
#end
#implementation FBSession
#end
#interface FBSessionTokenCaching:NSObject
#end
#implementation FBSessionTokenCaching
#end
#interface FBSessionTokenCachingStrategy:NSObject
#end
#implementation FBSessionTokenCachingStrategy
#end

You have to delete the old ParseFacebookUtils.framework and keep the new ParseFacebookUtilsV4.framework to get it working.

I loved dbquarrel's answer, but it doesn't work anymore because it is lacking some new social classes.
So do the same thing, but instead, add this:
NSString *FBTokenInformationExpirationDateKey = #"";
NSString *FBTokenInformationTokenKey = #"";
NSString *FBTokenInformationUserFBIDKey = #"";
NSString *SLServiceTypeTwitter = #"";
NSString *ACAccountTypeIdentifierTwitter = #"";
#interface FBAppCall:NSObject
#end
#implementation FBAppCall
#end
#interface FBRequest:NSObject
#end
#implementation FBRequest
#end
#interface FBSession:NSObject
#end
#implementation FBSession
#end
#interface FBSessionTokenCaching:NSObject
#end
#implementation FBSessionTokenCaching
#end
#interface FBSessionTokenCachingStrategy:NSObject
#end
#implementation FBSessionTokenCachingStrategy
#end
#interface ACAccountStore:NSObject
#end
#implementation ACAccountStore
#end
#interface SLRequest:NSObject
#end
#implementation SLRequest
#end
#interface SLComposeViewController:NSObject
#end
#implementation SLComposeViewController
#end

Check and make sure that you do not have two versions of the "ParseFacebookUtils" framework added there is:
ParseFacebookUtilsV4
and
ParseFacebookUtils
Once I removed ParseFacebookUtils, and kept ParseFacebookUtilsV4 it worked fine.

My Solution will definitely work and you can use -ObjC in other linker flags.
Add "Social.framework" , "Account.framework"
Add "FacebookSDK.framework"
Cheers....now it works..... and no need of removing -ObjC.

Sounds like you might need to add the 'Accounts.Framework' and/or the 'Social.Framework'.

A complementary to the answer by #blueHula .
Parse has removed Facebook SDK from its framework, meaning that from some certain version (1.1.33 maybe) integrating parse.framework should be accompanied by integrating FB SDK independently.
Please refer to this link using the parse ios sdk without including the facebook sdk
The key point is to use -force_load $(SRCROOT)/path/libname.a to link with necessary third-party libraries, rather than using -all_load and -ObjC

It is a linker error... You are not including a needed framework in your project which you are referencing in one of you included header files.
So, for example, if you an have an include in your code:
#import <Parse/Parse.h>
It probably requires a supporting framework, and you have to include it in your app. Did you include the parse.framework from within Xcode?

I had the same use and and the only third party I had was the PayPal SDK. After removing -ObjC everything built fine. (always make a backup of you project before changing settings)

it's 2015 and I just had the same error. Unfortunately, none of the above answers worked for me. But this did:
Target > Build Phases > Link Binary With Libraries
then add libstdc++.6.dylib
This solved the problem for me.

There are many frameworks that needs to set -ObjC flag as Other linked flag, whereas Parse do not allow you to proceed if you do so. To deal with this you can do one of following things. I have shown example of Google Maps SDK that needs -ObjC flag, but due to Parse in the same project I can not use it directly:
Solution 1 - Using force_load Flag
Instead of setting -ObjC flag as Other linked flag, use force_load flag to load particular framework or library.
-force_load $(SRCROOT)/GoogleMaps.framework/Versions/A/GoogleMaps
Solution 2 - Using Facebook SDK
Just Add Facebook SDK as a separate framework, this will allow you to use -ObjC flag. Also make sure you have added Accounts.framework and Social.framework. If you have added Bolt.framework and using Parse blank project then to deal with duplicate symbol remove Bolt.framwork.
If still it have few errors then remove Accounts and Social framework and Add it again (This will be the case if you have used Parse default blank project).

I was bothered this issue for many days. I used cocoapods to manage all of third SDK.
Here is how I resolved this issue. Go to pod project and set the item "build architecture only" to NO.
Rebuild pod project and then link errors is gone! help this can help someone who is using cocoapods.

I had the same problem. I solved by downloading the previous version (1.1.32) from here:
https://parse.com/downloads/ios/parse-library/1.1.32
(In my case I needed the -ObjC flag)
Edit: It seems that version doesn't work with 64 bit architectures.

This can be removed from the project-file located in
<projectname>/cordova/<projectname>/platforms/ios/<projectname>.xcodeproj/project.pbxproj and
Search the file for -ObjC, there are multiple locations. It looks like this:
OTHER_LDFLAGS = (
"-weak_framework",
CoreFoundation,
"-weak_framework",
UIKit,
"-weak_framework",
AVFoundation,
"-weak_framework",
CoreMedia,
"-weak-lSystem",
"-force_load",
"\"$(BUILT_PRODUCTS_DIR)/libCordova.a\"",
"-ObjC",
);

Install cocoaPods and add this to your Podfile:
pod 'Facebook-iOS-SDK'
pod 'Parse'
pod 'ParseFacebookUtils'

Related

Using iOS 11 NEHotspotConfiguration capability on a Simulated Device and not just a physical device

I'm using the NEHotspotConfiguration Class in iOS 11 to connect to a known wifi network. This React Native app works fine on a physical device, and I'm able to programatically connect to a network using the NEHotspotConfiguration class on iOS 11. However, when I try and build/run it in a simulator I get the following error that prevents me from even launching the app:
Undefined symbols for architecture x86_64:
"_OBJC_CLASS_$_NEHotspotConfiguration", referenced from:
objc-class-ref in IOSWifiManager.o
"_OBJC_CLASS_$_NEHotspotConfigurationManager", referenced from:
objc-class-ref in IOSWifiManager.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 a way to keep using the Simulator to test the rest of my app with this capability enabled, even though I wouldn't be able to use the capability to change the wifi in the Simulator?
There may be other options, but I found the following potential answer in the comments of a medium article that led me to one solution:
https://medium.com/#ercp42/i-got-this-error-ceacd08191b3
"For anyone who experiences the same issue, I fixed it by wrapping the NetworkExtension import and the code where it’s used with #if !TARGET_IPHONE_SIMULATOR to side step this issue."
It was a bit more than that, at least for me, though.
I did indeed wrap the #implementation IOSWifiManager implementation in the IOSWifiManager.m file with an #if TARGET_OS_IPHONE && !TARGET_OS_SIMULATOR and left a much simpler else statement to build it on the simulator:
#else
#implementation IOSWifiManager
RCT_EXPORT_MODULE();
#end
#endif
I also went into build settings and under Linking Other Linker Flags changed the values for the iOS Simulator and Any Architecture to the following:
"OTHER_LDFLAGS[arch=*]" = (
"$(inherited)",
"-ObjC",
"-lc++",
"-framework",
NetworkExtension,
);
"OTHER_LDFLAGS[sdk=iphonesimulator*]" = (
"$(inherited)",
"-ObjC",
"-lc++",
);
Finally, I changed the Network Extension Framework from being required to being optional and made sure that we were supporting the right build architectures. Hopefully that helps anyone who runs into the same issue!

WCSession in iOS App using WatchKit 2 Stops App Building

I'm trying to setup communication between my Watch App and my iPhone App using the new WCSession stuff in iOS 9.
Everything went smoothly adding the WCSession to the watch extension but once I try to add the same thing into my phone target the app will no longer build and gives me this error.
Undefined symbols for architecture x86_64:
"_OBJC_CLASS_$_WCSession", referenced from:
objc-class-ref in AppDelegate.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I'm importing it with this:
#import <WatchConnectivity/WatchConnectivity.h>
and then trying to call:
if ([WCSession isSupported])
{
self.session = [WCSession defaultSession];
self.session.delegate = self;
[self.session activateSession];
}
There aren't any errors showing up in the Xcode editor. It just won't build. I'm trying to run it on the simulator.
Any ideas?
Have you added a reference to the WatchConnectivity.framework to your iOS project? It needs to be referenced in both the iOS and watchOS projects.
Add "WatchConnectivity.framework" using "Link Binary With Libraries" in "Build Phases" in ios app.
Make sure that you have imported
#import <WatchConnectivity/WatchConnectivity.h> in ios app and watch app.
Also view controller in ios app and InterfaceController in watch app conforms to <WCSessionDelegate>

Excluding framework from iOS Simulator build

I am using a third party framework in my app (metaioSDK) and it's not provided in i386 version. I was hoping to be able to exclude it from simulator builds so that I can test functionality unrelated to this framework on the simulator. I followed the answer in this question: How to exclude frameworks in simulator builds in Xcode and made sure to wrap any code that uses this framework in #if/#else/#endif like this:
// ARViewController.h
#import <UIKit/UIKit.h>
#if TARGET_IPHONE_SIMULATOR
#interface ARViewController : UIViewController {
}
#end
#else
#import <metaioSDK/MetaioCloudPlugin/MetaioCloudPluginViewController.h>
#interface ARViewController : MetaioCloudPluginViewController
{
bool m_useLocationAtStartup;
}
#end
#endif
Similarly, I've changed the related ARViewController.m file to have a blank implementation when running on simulator.
Yet, Xcode still appears to want to link some portions of this framework, and I get errors:
Undefined symbols for architecture i386:
"_fopen$UNIX2003", referenced from:
_BIO_new_file in metaioSDK(bss_file.o)
_file_ctrl in metaioSDK(bss_file.o)
_open_console in metaioSDK(ui_openssl.o)
"_fputs$UNIX2003", referenced from:
_write_string in metaioSDK(ui_openssl.o)
_read_string in metaioSDK(ui_openssl.o)
"_fwrite$UNIX2003", referenced from:
_XrAQWOpNWyNOaebKZvBRbL in metaioSDK(pngwio.o)
_file_write in metaioSDK(bss_file.o)
_int_rsa_verify in metaioSDK(rsa_sign.o)
_send_fp_chars in metaioSDK(a_strex.o)
_write_fp in metaioSDK(b_dump.o)
_read_string in metaioSDK(ui_openssl.o)
"_nanosleep$UNIX2003", referenced from:
boost::this_thread::hiden::sleep_for(timespec const&) in metaioSDK(thread.o)
boost::this_thread::hiden::sleep_until(timespec const&) in metaioSDK(thread.o)
"_strerror$UNIX2003", referenced from:
_build_SYS_str_reasons in metaioSDK(err.o)
"_strtod$UNIX2003", referenced from:
_WWOVfTQLpCQpcac in metaioSDK(pngrutil.o)
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
What else am I missing aside from marking this framework as optional?
The problem is that your third party framework DOES include an i386 version, but that i386 version was built against the wrong SDK. It was built against the OS X SDK and should have been built against the iOS Simulator SDK. File a bug report with the metaioSDK developers to get them to fix the bug.
If you duplicate your target and remove the framework from the linked frameworks list, you can use this new target to build for simulator. It's a little less "just know what I want and do the thing", but it'll definitely solve your issue and the relationship will be explicitly marked.

CLLocation subclassing on OSX

I'm working on a more advanced CLLocationManager mock than the one provided by Xcode and I ran into a strange issue. I have subclassed both CLLocationManager and CLLocation:
// foobar.h
#interface MyLocation : CLLocation
#end
#interface MyLocationManager : CLLocationManager
#end
// foobar.m
#implementation MyLocation
#end
#implementation MyLocationManager
#end
Now if I build the project for iOS everything is fine but when I do the same for OS X, I get this error at linking:
Undefined symbols for architecture x86_64:
"_OBJC_METACLASS_$_CLLocation", referenced from:
_OBJC_METACLASS_$_MyLocation in AppDelegate.o
"_OBJC_METACLASS_$_CLLocationManager", referenced from:
_OBJC_METACLASS_$_MyLocationManager in AppDelegate.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Unlike in this question Error on CLLocation subclassing, I do have the proper frameworks added to the project and, as I said, this setup builds flawlessly for iOS, just not for OSX.
FWIW, I'm using Xcode 4.6.3 with iOS SDK 6.1 and OSX SDK 10.8, building for x86_64 with the default LLVM 4.2.
Any clues why this is happening?
Linker errors are something to do with the framework. Forgetting to import the framework somewhere or add the Core Location framework to the OS X target. If it works for one but not the other, it sounds like the two targets are set up differently.
Double check. Clean the build. Restart Xcode.

How can I create an instance of this class?

I'm using PhoneGap to develop an plug-in for a Heart Rate Monitor, it has the following header file in their SDK:
#class HRMonitor;
#interface HRMonitor : NSObject <NSStreamDelegate>{
}
-(id) init: (id) _delegate;
-(void)startup;
-(void)shutdown;
I just listed the Method that I'm having trouble with.
I also have a class HRMPlugin.m, but inside this class, whenever I want to create an instance:
HRMonitor *hrm = [[HRMonitor alloc] init:self]
It will report an error:
ld: warning: ignoring file /Users/octref/Documents/HRM/HRMPlugin/iOS_APP_SDK_r5/libmyTrekSDK_armv7.a, missing required architecture i386 in file /Users/octref/Documents/HRM/HRMPlugin/iOS_APP_SDK_r5/libmyTrekSDK_armv7.a (2 slices)
Undefined symbols for architecture i386:
"_OBJC_CLASS_$_HRMonitor", referenced from:
objc-class-ref in HRMPlugin-9E97FDE3BF57274E.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I'm new to iOS and don't know what to do. Is my way of creating a new instance correct?
How can I debug my code?
The reason of your error is:
The library you use does not support iOS Simulator.
For the 2nd error, please make sure you have a valid Apple Developer Account with Developer Certificate and Provisioning Profile ( Team Provisioning Profile is also okay ).

Resources