Undefined symbols for architecture armv7 SSZipArchive - ios

Undefined symbols for architecture armv7:
"_OBJC_CLASS_$_SSZipArchive", referenced from: objc-class-ref in
LoginVC.o ld: symbol(s) not found for architecture armv7 clang: error:
linker command failed with exit code 1 (use -v to see invocation)

just solved! I really tried everything, but yeah, it has catched me too now -> CMD+alt+Return, I only have to clean it, and now it works.
Be careful, if you have same problems with SSZipArchive check this:
- check the prefix.pch: You added some objective-C classes here? -->so just move it into
#ifdef __OBJC__
#import <UIKit/UIKit.h>
#import <Foundation/Foundation.h>
#endif
...cause minizip is compiling together with objective-classes, and thats a problem for minizip, so move it into #ifdef to work clear.
- clean baby: Just clean like me your project, if you tried many mistakes before [CMD]+[alt]+return - be careful
- add SSZipArchive not as reference: Just create your SSZipArchive to first like:
SSZipArchive
SSZipArchive.h
SSZipArchive.m
minizip(folder)
..just look also thisNiceLink..but it can work anyway as referenced folder, look here..both don't worked for me (cause I don't cleaned after experiments ;))..I have created a folder construct like above on finder, and drag drop it into my project (just click "create groups")
..so I hope it helps you.. :)

Related

.c File via Bridging Header Not Working After Xcode 8 Update

The app I've been working on uses an external library, pdlib, which has it's own externals (.c files) which I've been importing via the bridging header #import "Uzi.c" and calling in my main Swift file via Uzi.c's setup function Uzi_setup() in my ViewController class. I've had no problem with this until after updating to new public Xcode 8 a few days ago (I had no problem with Xcode 8 Beta 1 over the Summer).
Here are the 7 errors I get, listed under a single "Mach-O Linker Error" umbrella:
Undefined symbols for architecture x86_64:
"_Uzi_bang", referenced from:
_Uzi_setup in ViewController.o
"_Uzi_class", referenced from:
_Uzi_setup in ViewController.o
"_Uzi_float", referenced from:
_Uzi_setup in ViewController.o
"_Uzi_new", referenced from:
_Uzi_setup in ViewController.o
"_Uzi_pause", referenced from:
_Uzi_setup in ViewController.o
"_Uzi_resume", referenced from:
_Uzi_setup in ViewController.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Those undefined symbols are 6 functions and a class declare from Uzi.c. Here's a link to the whole c file: https://github.com/electrickery/pd-miXedSon/blob/master/hammer/Uzi.c
I've tried every solution I've found online for dealing with similar problems, with no solution yet... I tried changing the "Architecture" and "Valid Architecture" settings to only armv7 and armv7s (no arm64) and changed "Build Active Architecture Only" to "No". These step seem to help others in similar situations, but they didn't work for me (and taking away arm64 causes additional errors to appear).
XCode 8 is pretty recent (the public version was released Sept. 13), so there are virtually no other questions about this upgrade causing a similar problem.
Any help would be greatly appreciated!
Solved by #danomatika on GitHub: https://github.com/libpd/libpd/issues/149
"You generally shouldn't include/import an implementation file aka .c, .cpp, .m, etc. This is what is causing the duplicate symbol issue.
This is what the "forward function declaration" in the header file is for: to tell the compiler that a function exists and what data it takes/returns. The compiler then assumes the actual implementation of the function exists in an implementation file. If it can't be found, then you get an "undefined symbol error." If you somehow end up declaring the function twice, aka include both a header with the forward declaration and the implemetaton of the function itself in the .c file, then you get a "duplicate symbol error."
This is all lower-level stuff that is only really an issue since Pd externals are designed around being dynamic libraries, so are not built or provided with headers which include the function declarations. This is why you have to do a little extra work and do it yourself.
Their are two easy fixes for this, both of which involve declaring the required function you want to call from the .c file in a header file.
Simply declare the function in the bridging header:
void uzi_setup();
Create a header, say Externals.h, and declare all of the externals stuff there:
// forward declare setup functions only found in .c implementations
void uzi_setup();
// convenience wrapper function
void externals_setup() {
uzi_setup();
}
Then import the file in your bridging header:
#import "Externals.h"
And in swift, you can now do:
externals_setup()

Admob Conversion Tracking in Swift

I tried to set conversion tracking in my iOS game, but I didn't be able to do that. The tutorial can be found here: https://developers.google.com/app-conversion-tracking/ios/?hl=it#usage_and_disclosure
I integrate the GoogleConversionTrackingSDK to my project, load AdSupport framework and type -ObjC in Other linker flags.
I tried to convert this snippet from Obj-C:
[ACTConversionReporter reportWithConversionID:#"MY_ID" label:#"MY_LABEL" value:#"MY_VALUE" isRepeatable:NO];
to Swift:
ACTConversionReporter.reportWithConversionID("MY_ID", label: "MY_LABEL", value: "MY_VALUE", isRepeatable: false)
and I put that in didFinishLaunchingWithOptions method of AppDelegate.swift, but I get the error:
Use of unresolved identifier 'ACTConversionReporter'
If I type in Obj-C bridging header in Swift Compiler - Code Generation in Build Settings "ACTReporter.h" (without qm), I put the header file in the folder of my game or if I type the whole path of "ACTReporter.h" ending with its name, I fail the build and I get 2 errors:
Undefined symbols for architecture armv7:
"_OBJC_CLASS_$_ACTConversionReporter", referenced from:
type metadata accessor for __ObjC.ACTConversionReporter in AppDelegate.o
ld: symbol(s) not found for architecture armv7 clang: error: linker
command failed with exit code 1 (use -v to see invocation)
I don't know what to do. I hope there is someone who can fix this.
You need to add to your project "YourProjectName-Bridging-Header.h" file
Here you can see how to add the file
in Bridging Header file add #import "ACTReporter.h"
Then it will work for you!

CoreLocation Undefined symbols for architecture i386

I got the following error:
Undefined symbols for architecture i386:
"_CLLocationCoordinate2DMake", referenced from:
-[ViewController loadView] in ViewController.o
I looked at previous StackOverflow posts and they said to make sure the CoreLocation.framework was in "Link Binary with Libraries" in the build phases tab in the target, which I did.
There are two things you need to do:
1 )
Make certain your target membership is checked on for CoreLocation.framework, like this:
2 )
Make certain that you have done an "#import <CoreLocation/CoreLocation.h>" at the top of your ViewController.m file.

Apple Mach-O Linker errors and I don't know what to do

I cannot compile my project for the device or simulator anymore. I get 13 Apple Mach-O-Linker errors. It all started after I failed attempt to use sharekit. Here is the log from the error:
ld: warning: directory not found for option '-F/Users/bbrandy95/Documents/Broken Brandsonic Web Projects/Brandsonic Web mobile/../../Downloads/0.2.1gm1/iphoneos4.0/System/Library/Frameworks'
Undefined symbols for architecture armv7:
"_OBJC_CLASS_$_NSURLRequest", referenced from:
objc-class-ref in Brandsonic_Web_mobileAppDelegate.o
objc-class-ref in Brandsonic_Web_mobileViewController.o
"_OBJC_CLASS_$_NSAutoreleasePool", referenced from:
objc-class-ref in main.o
"_objc_msgSendSuper2", referenced from:
-[Brandsonic_Web_mobileAppDelegate dealloc] in Brandsonic_Web_mobileAppDelegate.o
-[Brandsonic_Web_mobileViewController didReceiveMemoryWarning] in Brandsonic_Web_mobileViewController.o
-[Brandsonic_Web_mobileViewController dealloc] in Brandsonic_Web_mobileViewController.o
"_objc_setProperty", referenced from:
-[Brandsonic_Web_mobileAppDelegate setWindow:] in Brandsonic_Web_mobileAppDelegate.o
-[Brandsonic_Web_mobileAppDelegate setViewController:] in Brandsonic_Web_mobileAppDelegate.o
"__objc_empty_vtable", referenced from:
_OBJC_CLASS_$_Brandsonic_Web_mobileAppDelegate in Brandsonic_Web_mobileAppDelegate.o
_OBJC_METACLASS_$_Brandsonic_Web_mobileAppDelegate in Brandsonic_Web_mobileAppDelegate.o
_OBJC_CLASS_$_Brandsonic_Web_mobileViewController in Brandsonic_Web_mobileViewController.o
_OBJC_METACLASS_$_Brandsonic_Web_mobileViewController in Brandsonic_Web_mobileViewController.o
_OBJC_METACLASS_$_SecondView in SecondView.o
_OBJC_CLASS_$_SecondView in SecondView.o
"_objc_msgSend", referenced from:
_main in main.o
-[Brandsonic_Web_mobileAppDelegate application:didFinishLaunchingWithOptions:] in Brandsonic_Web_mobileAppDelegate.o
-[Brandsonic_Web_mobileAppDelegate dealloc] in Brandsonic_Web_mobileAppDelegate.o
-[Brandsonic_Web_mobileAppDelegate GOOGLE] in Brandsonic_Web_mobileAppDelegate.o
-[Brandsonic_Web_mobileAppDelegate YOUTUBE] in Brandsonic_Web_mobileAppDelegate.o
-[Brandsonic_Web_mobileAppDelegate WIKI] in Brandsonic_Web_mobileAppDelegate.o
-[Brandsonic_Web_mobileViewController webView:shouldStartLoadWithRequest:navigationType:] in Brandsonic_Web_mobileViewController.o
...
"__objc_empty_cache", referenced from:
_OBJC_CLASS_$_Brandsonic_Web_mobileAppDelegate in Brandsonic_Web_mobileAppDelegate.o
_OBJC_METACLASS_$_Brandsonic_Web_mobileAppDelegate in Brandsonic_Web_mobileAppDelegate.o
_OBJC_CLASS_$_Brandsonic_Web_mobileViewController in Brandsonic_Web_mobileViewController.o
_OBJC_METACLASS_$_Brandsonic_Web_mobileViewController in Brandsonic_Web_mobileViewController.o
_OBJC_METACLASS_$_SecondView in SecondView.o
_OBJC_CLASS_$_SecondView in SecondView.o
"_OBJC_CLASS_$_NSObject", referenced from:
_OBJC_CLASS_$_Brandsonic_Web_mobileAppDelegate in Brandsonic_Web_mobileAppDelegate.o
"___CFConstantStringClassReference", referenced from:
CFString in Brandsonic_Web_mobileAppDelegate.o
CFString in Brandsonic_Web_mobileAppDelegate.o
CFString in Brandsonic_Web_mobileAppDelegate.o
CFString in Brandsonic_Web_mobileViewController.o
CFString in Brandsonic_Web_mobileViewController.o
CFString in Brandsonic_Web_mobileViewController.o
CFString in Brandsonic_Web_mobileViewController.o
...
"_OBJC_CLASS_$_NSKeyedUnarchiver", referenced from:
objc-class-ref in Brandsonic_Web_mobileViewController.o
"_OBJC_CLASS_$_NSUserDefaults", referenced from:
objc-class-ref in Brandsonic_Web_mobileViewController.o
"_OBJC_CLASS_$_NSURL", referenced from:
objc-class-ref in Brandsonic_Web_mobileAppDelegate.o
objc-class-ref in Brandsonic_Web_mobileViewController.o
"_OBJC_METACLASS_$_NSObject", referenced from:
_OBJC_METACLASS_$_Brandsonic_Web_mobileAppDelegate in Brandsonic_Web_mobileAppDelegate.o
_OBJC_METACLASS_$_Brandsonic_Web_mobileViewController in Brandsonic_Web_mobileViewController.o
_OBJC_METACLASS_$_SecondView in SecondView.o
ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)
'
How do I fix this? Please help.
For every one with an similar error.
If that happens you normally can remove the "Path" under Point
target->Build Settings->Library Search Paths
This error can occur when a framework is added to a project more than once.
You can fix this by removing the duplicate. To find it, select the framework in the Xcode project navigator and choose Show in Finder. Then clean and build your project.
This can also be caused if you're missing framework header files or a reference to them.
In that case, you should trying removing the SDK or framework and adding it again.
Good luck.
If you installed dependencies using CocoaPods, make sure you open your XCode project by clicking on your .xcworkspace file, and not the .xcodeproj file.
It seems like the project file may have been corrupted somehow.
The most sure way to fix this is to create a new project, and move your files and old info.plist over on top of it.
The next most likely way to fix this is to create a new target in your current project, and see if that will compile (if you have any special flags from the old target you'll want to copy them).
Also you could try compiling for Release vs. Build and if one of them works look at all of the compiler options and see what is different.
If you added a header search path for Sharekit, perhaps try clearing out the whole header search path and see if that fixes things. Also make sure your project is still including frameworks that a brand new project includes (UIKit and NSFoundation, possibly others).
Add the .m file to compile source page.
steps:-
clicking on he project in the navigation menu
select the target
select build phases
Select the + button and add the file in compile sources.
Hope that helps anyone with this problem
The problems are the spaces in your path:
xcode uses the following switch for the linker:
-F/Users/bbrandy95/Documents/Broken Brandsonic Web Projects/Brandsonic Web mobile/../../Downloads/0.2.1gm1/iphoneos4.0/System/Library/Frameworks
and since it is not quoted it won't work. ( It is looking for the folder "/Users/bbrandy95/Documents/Broken"
You should rename the directories, or look through the project settings and add quotes to the directories. (But this might be tricky to find)
I too had the same problem with 45 same kind errors, when I add the libxml2.dylib into my project the errors disappeared.
In some cases your library Search Path is empty.Because there are many Apple-mac-o linker errors.
See my answer also at.
Apple Mach-O Linker Error using Core Data classes in OCUnit
I had this issue, now for my circumstances selecting a more recent iOS version as the deployment target rectified this for me. My project was set to deploy to iOS 5 by default and changing this to 7 (the most recent) did the trick.
For anyone new to iOS development this can be done by clicking on your XCode project file in the navigator > deployment info > deployment target and selecting the appropriate version from the drop down menu.
I'm sceptical that this will solve some of the issues that others are having but there may be a few people out there in the same boat as me.
It's because the project inserted the core data's xcdatamodeld file in compile sources. Select your project -> Build Phases -> Compile Sources and delete projectName.xcdatamodeld file.
And also check if you have imported .m file instead of .h file, it also gives the same linker error. Check all the #import codes.
And check if you have added core data frame work in library and imported core data .h file. Check for creation of NSManagedObject and import it's file.
Just try it and reply me if still any error.
I had the same problem,
I just simply set the Build Option -> Enable Bitcode to NO
I faced this problem with my self developed cocoapod.
Error was: Apple Mach-O Linker errror
It turned out, that I had defined a protocol and implemented a protocol extension. One method of the protocol extension was public, but the protocol itself was not. And this caused the Apple Mach-O Linker error.
Example:
protocol MyProtocol { var field: String { get} }
extension MyProtocol { public func giveMeSomething() -> String }
public class MyClass: MyProtocol {}
In the description the error mentioned MyClass referenced from MyProtocol -> MyProtocol referenced from giveMeSomething()...
So, the solution was to make Myprotocol also public
Hope that helps someone.

"symbol(s) not found for architecture i386" problem using ShareKit

I want to use the http://getsharekit.com framework for future iOS projects. Hence I started testing out the framework.
But I already get the following error:
Undefined symbols for architecture i386:
"_OBJC_CLASS_$_SHKItem", referenced from:
objc-class-ref in ShareKitTestAppDelegate.o
"_OBJC_CLASS_$_SHKActionSheet", referenced from:
objc-class-ref in ShareKitTestAppDelegate.o
ld: symbol(s) not found for architecture i386
collect2: ld returned 1 exit status
Often, as far as I know, these problems arise if header files are wrongly imported. But I don't see any error here in the following code where the problem above occurs:
#import "ShareKitTestAppDelegate.h"
#import "SHK.h"
#import "SHKItem.h"
#import "SHKActionSheet.h"
- (IBAction) letshare:(id)sender
{
// Create the item to share (in this example, a url)
NSURL *url = [NSURL URLWithString:#"http://getsharekit.com"];
SHKItem *item = [SHKItem URL:url title:#"ShareKit is Awesome!"];
// Get the ShareKit action sheet
SHKActionSheet *actionSheet = [SHKActionSheet actionSheetForItem:item];
// Display the action sheet
[self.window addSubview:actionSheet];
}
I also included the ShareKit Headers Folder into HeaderSearchPath Build-Options, because of searching for all the headers.
But I don't see any error here or anything missed.
Can somebody help me?
With best regards,
Andreas
I had a similar problem with the following linker error:
Undefined symbols for architecture i386: "_OBJC_CLASS_$_SHK"
I resolved it by adding SHK.m to compiled sources under Project settings->Target->Build Phases. Not sure why SHK.m was not in the compiled sources list, and it was working previous to duplicating the Target. After the duplication I couldn't link any of the targets.
Adding SHKItem.m or SHK.m to compiled sources might help you if they aren't there already.
Read this http://getsharekit.com/install/.
Have you added the frameworks?

Resources