Unity 4.6.5 project won't run on iOS simulator - ios

Unity 4.6.5 project won't run on iOS simulator and I'm getting runtime error:
dyld: Symbol not found: _OBJC_CLASS_$_CBAnalytics
Referenced from: /Users/diverseconnection/Library/Developer/CoreSimulator/Devices/983BAC55-2713-423B-B5F3-C135ECCC2768/data/Containers/Bundle/Application/D4CAC0C7-E3D6-48F5-B264-E6EB715F9709/trouble.app/trouble
Expected in: flat namespace
in /Users/diverseconnection/Library/Developer/CoreSimulator/Devices/983BAC55-2713-423B-B5F3-C135ECCC2768/data/Containers/Bundle/Application/D4CAC0C7-E3D6-48F5-B264-E6EB715F9709/trouble.app/trouble
(lldb)
Any ideas how to fix it?

Well this error is usually rather broad as there can be number of causes. You can try these fixes
Add the correct libraries in the Link Binary With Libraries section of the Build Phases.
If you want to add a library outside of the default search path you can include the path in the Library Search Paths value in the Build Settings and add -l{library_name_without_lib_and_suffix} (eg. for libz.a use -lz) to the Other Linker Flags section of Build Settings.
You copy files into your project but forgot to check the target to add the files to. To resolve:
Open the Build Phases for the correct target, expand Compile Sources and add the missing .m files.
You include a static library that is built for another architecture like i386, the simulator on your host machine. To resolve:
If you have multiple library files from your libraries vendor to include in the project you need to include the one for the simulator (i386) and the one for the device (armv7 for example).
Optionally, you could create a fat static library that contains both architectures.
Also try this
Remove Build Active Architecture Only (build setting parameter key is 'ONLY_ACTIVE_ARCH') from all of your static libraries' project build settings or overwrite it with 'NO'

Related

Xcode project giving pod file error for FIRAnalyticsConnector.framework . How to solve it?

I'm working on a book project and the project is connected by API . I'm working on the book app which has different libraries imported from the various places.
Recently, i cloned the project from bitbucket in Xcode and tried to run it. The result i got i error as follows:
enter image description here
It shows :
ld: in /Users/ishinfoservices/Documents/vadltaldhambooks/Pods/FirebaseAnalytics/Frameworks/FIRAnalyticsConnector.framework/FIRAnalyticsConnector(FIRAnalyticsConnector_a8eeba373b74508311b8b22b8d3202a6.o), building for iOS Simulator, but linking in object file built for iOS, file '/Users/ishinfoservices/Documents/vadltaldhambooks/Pods/FirebaseAnalytics/Frameworks/FIRAnalyticsConnector.framework/FIRAnalyticsConnector' for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Help needed to fix the error, as the project has lots of mixes of old libraries along with .h and .m files, the swift files with wireframes
According to the image I saw that you are trying run the app on the iOS simulator, then you could try to add the arm64 to the Excluded Architectures on the Build Settings section of your project or target, it would be like:
Take in mind that if you use Cocoa Pods is possible that also you should add the arm64 to the Exclude Architectures into the Pods project
After the above, clean, build and run the project on the iOS simulator, is possible that on your physical device you must remove the arm64 from the Exclude Architectures, it could depend on what you use in your project.
On the other hand, you can try the following: Select the project -> Select the target -> Go to the Build Phases -> Expand the Link Binary with libraries and add all pod libraries (remove if they exist in embedded binaries or Remove the old FrameWorks), after that, clean and build the project

Unable to build framework

I am unable to build a framework doing following->
1.Select a simulator in run devices
2.Under Product -> build in Xcode tool bar
3.Right click on the product section ->show in finder
now in terminal I execute following command->
lipo -info /path/to/debugfolder/
it gives me follwing error -
fatal error: /Applications/Xcode
app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/lipo:
can't map input file:
/Users/Imacshubhendra/Library/Developer/Xcode/DerivedData/SendOTPFramework-hkrvnvttlmwijudmlfcaxdowqhpz/Build/Products/Debug-iphoneos/SendOTPFramework.framework
(Invalid argument)
I am follwing these steps->
In the framework project:
Set the build setting for the target (and for the project, just to be safe) 'Build Active Architectures only' to NO. We want to build all architectures so that the binary can be used in all supported devices, not just the one we happen to build for. Depending on your deployment target (and as a consequence of that, the devices you support), you might need to add the architecture ARMv7s
Build for simulator and build for device, this will produce two frameworks in the derived data folder.
In Terminal:
Find the derived data path for the project. Look for the folder 'Build->Products'. Inside it should be '-iphoneos' and '-iphonesimulator'. Inside each is a .framework folder. Copy one of those to some nice folder. From each of those .frawework folders, copy the binary that is in there to one folder.
In terminal run the command 'lipo -create -output '. This will create a fat binary with all architectures for both simulator and devices. Replace the one in the copied .framework directory with the newly generated one.
To use the framework in another app:
Select the Project in the Project Navigator, select the target, and select 'General' tab.
drag the .framework folder onto where it says 'Add embedded binaries here'.
In the build settings of the target, add the path to the .framework folder to 'Framework Search Paths'.
Import files in your source code using #import

Can't link fat iOS static library

I recently downloaded a fat, iOS static library for the popular C library boost. All my attempts in coaxing Xcode to link it have failed.
Things I have tried:
Adding it to Link Binary With Libraries.
Changing file type to Mach-O Object Code using File Inspector.
Renaming the file to libboost.a and adding -lboost to Other Linker Flags.
I am using Xcode 6.3 with the latest command line tools.
How To Link to an Xcode Project?
In Xcode Build Settings for your project: LIBRARY_SEARCH_PATHS
ofxiOSBoost/libs/boost/lib/ios
(Set this to the directory where the static library is)
In Target under Build Phases for your project
Add to 'Link Binary With Libraries' the boost.a found in the ofxiOSBoost/libs/boost/lib/ios directory.
Renaming to libboost.a may be breaking it. The ofxiOSBoost renames this file as to not conflict with internal OSX libs in the linking process if in path / sys, so it links correctly with the iOS Binary.
If you are still having this problem, please open an issue here:
https://github.com/danoli3/ofxiOSBoost/issues

[Possible Duplicate]: Undefined symbols for architecture i386:

I know there are lot of questions and answers are available like this but since 2 days I tried to figure out this issue and not got any success.
I have added the below listed frameworks in my projects,
libSqlite3.dylib
AddressBook.framework
AssetsLibrary.framework
AVFoundation.framework
CoreMotion.framework
MediaPlayer.framework
but not getting any success
I think you've copied the Frameworks into your project, rather than just linking to them, so they only contain the library compiled for device. Xcode will normally locate the Simulator version of the framework for you.
Delete any of the .framework folders in your project and Finder, then follow Step 6 of this tutorial with the frameworks you listed in your original post: http://quickblox.com/developers/IOS-how-to-connect-Quickblox-framework#Framework
This library AssetsLibrary.framework in Step 3, is not included in your project, that's why you are getting this error.
Try these:
You need to add the AssetsLibrary framework to the “Link Binary With Libraries” build phase of your target.
Try cleaning your project using Command+Shift+K and adding the required frameworks again. Hope it will start working
Copy files into your project but forgot to check the target to add the files to. To resolve: Open the Build Phases for the correct target, expand Compile Sources and add the missing .m files.
Another cause, may be:
You include a static library that is built for another architecture like i386, the simulator on your host machine. To resolve:
If you have multiple library files from your libraries vendor to include in the project you need to include the one for the simulator (i386) and the one for the device (armv7 for example).
Missing library or missing .m file
Check and add:
TargetSettings -> Build Phases -> Compile Sources -> add your .m class -> Build and Run

XCode linking error to cached library information without being called (Undefined symbols for architecture)

I am attempting to use a static library (.a) for which I also have the header files (no .m files), but when I add the library to my target (without even referencing/importing the library in my project code), I receive the Undefined symbols for architecture armv7 linking error at compile time. The linker is complaining about classes that supposedly no longer exist in the newest version of the library, and may be using cached data? That suspicion could be supported by the finding that if I create a blank project and add the library in the exact same way as I added it to my project, the new project compiles without issue. But on another note, when I grep my file system for the classes/ivars the linker is complaining about, I get matches in my static library file and my xcuserdata workspace folders. So I am wondering if the issue is in my project, the library I am trying to import, or the way in which I am trying to add the library to my project? And also, why do I get linker errors when I am not even importing/calling the library from my code? I am using XCode 4.6.1.
The linking error is as follows:
Undefined symbols for architecture armv7:
"_OBJC_IVAR_$_GenericPopupView.delegateTheme", referenced from:
-[MyListView setDelegateTheme:] in myLib.a(MyListView.o)
-[MyListView tableView:cellForRowAtIndexPath:] in myLib.a(MyListView.o)
"_OBJC_CLASS_$_SampleMarkView", referenced from:
objc-class-ref in myLib.a(MyListView.o)
"_OBJC_CLASS_$_CheckMarkView", referenced from:
objc-class-ref in myLib.a(MyListView.o)
"_OBJC_METACLASS_$_GenericPopupView", referenced from:
_OBJC_METACLASS_$_MyListView in myLib.a(MyListView.o)
"_OBJC_CLASS_$_GenericPopupView", referenced from:
_OBJC_CLASS_$_MyListView in myLib.a(MyListView.o)
ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I added the library to my target by performing the following steps:
Right-click on my project
Select 'Add Files to "My Project"'
Locate the .a file through the popup Finder window
Verify the library path is in my Target -> Build Settings -> Library Search Paths (automatically added when I complete step 3)
Add the header directory to Target -> Build Settings -> Header Search Paths
Verify that the library is listed in Target -> Build Phases -> Link Binary With Libraries
Verify that the library is compiled for armv7 via file, otool, & lipo (I heard the library may also include armv6s, but I didn't see armv6 when I used the three commands)
$ file myLib.a
myLib.a: Mach-O universal binary with 2 architectures
myLib.a (for architecture armv7): current ar archive random library
myLib.a (for architecture cputype (12) cpusubtype (11)): current ar archive random library
$ otool -L myLib.a
Archive : myLib.a (architecture cputype (12) cpusubtype (11))
…
$ lipo -info myLib.a
Architectures in the fat file: myLib.a are: armv7 (cputype (12) cpusubtype (11))
Here are things I have tried inbetween each compile attempt without any success:
Clean the project with (apple)+shift+k
Clean the build directory (DerivedData) with (apple)+alt+shift+k
Delete all the DerivedData directories from the command line
Remove and re-add the library and its headers to my project
Add the library without the headers
Put the libraries in a project that is a target dependency instead of in my project directly
Note that I am unable to add the library as a Target Dependency in Build Settings; should I be able to?
I am also unable to add the library to the target's Build Scheme (via XCode menu's Product -> Scheme -> Edit Scheme... -> Build -> +)
Check the minimum iOS version via iOS Deployment Target in Build Settings – both my target and the library are iOS 6.0
Removed all target search paths except those required for my project to build without the new library as shown below (most importantly I removed the DerivedData from the linker path); my overall project build settings (not the target's build settings) contains no other search paths
Header Search Paths
$(BUILT_PRODUCTS_DIR)/usr/local/include
$(SRCROOT)/../MyLibDirectory/headers
Library Search Paths
$(inherited)
$(SRCROOT)/../TargetDependencyDirectory
$(SRCROOT)/../openssl/lib
$(SRCROOT)/../MyLibDirectory
Removed all other instances of the library on my machine (old versions)
Set the user-defined build setting USE_HEADERMAP = NO
Install on a newly imaged machine with a fresh project checkout and repeat all of the above steps
Add –ObjC++ to the other linker flags (-ObjC is already a linker flag)
Use armv6s by itself and with armv6 in the Valid Architecture under Build Settings for my target and the target dependencies
Set Build Active Architecture Only to Yes
Switched between adding the library in a project group vs. at the parent project group level
Add an import and instantiation of an object from the library in my project code
Played with the library's different settings for Location under Identity and Type in the Utilities window on the right side of XCode when the library is selected
Add the library to the target's Build Phases -> Link Binary With Libraries via the + then Add Other...
I have already tried the recommended steps in these and other posts (only the last two of these listed have actual instructions):
Xcode referencing old
framework
Xcode referencing old/removed frameworks, causing multiple interface
declarations
Xcode custom framework - No known method error
Undefined symbols for architecture armv7
I have not tried changing all of my files to .mm (I didn't need to for previous versions of this library), but I have a lot of .m files that I think might break if I change them all...
Any help or succestions are greatly appreciated! I'm really having a hard time figuring out why this new version of the library is giving me problems.
I resolved my own problem, or rather, the issue was with the black box of a library that I was including. From the command line performed the following command in a terminal window:
grep SampleMarkView myLib.a
Which resulted in:
Binary File:myLib.a matches
I talked to the person who created the library and they sent me an updated version that didn't cause the problem - I guess they had old references in their code. So at the very least I hope this post provides a list of various things to try if you are having a library referencing problem!

Resources