iOS Project Update Xcode 4.2 to Xcode 4.5 - iphone

In my Project I have done 90% development using XCode 4.2 (was only need to support 4.x,5.x), Now I need to Build for iOS 6 as well, so I switched to Xcode 4.5 & iOS 6. But I am facing lots of issues like framework error for "Sqlite3", "MobileCoreServices"
I have read below Thread but no success.
How to make Xcode 4.5 project work on previous version of Xcode?
Xcode linker Directory not found for option
Can anyone please tell me How can I compile "Sqlite3", "MobileCoreServices" frame work for ARMV7 & ARMV7S. I cant remove both from project, Since I have done almost :(

There are uncertainties for the exact reason behind this but your problem can be solved by any of the cases provided below.
Case 1 :
It may be due to any missing library like libsqlite3.dylib and libsqlite3.0.dylib or MobileCoreServices, so copy these files from any other computer and place these files in your computer.
Procedure:
1:Open xcode on the computer where these files exists, add libsqlite3.0.dylib in your project from link binary with libraries.
2: Right click on the libsqlite3.0.dylib and show in finder (same for MobileCoreServices).
3: Copy two files libsqlite3.0.dylib and libsqlite3.dylib and place on the same location on other computer where these files are missing.
Here you go, The problem may be solved in this way.
Case 2:
Reinstall XCode again it may work properly
Case 3:
Check this answer
Hope it helps you.

When click on your project in the project explorer, for each target, select that target. Then in the build phase, in the link with binary libraries, check your framework links.
If you have simple problem, you can remove and add the libraries again.
If the library is not built for arm7s, then goto target's archtecture, in the valid architectures, set it armv7 only. See if this remove the problem. if it is, then the frameworks needs to be build for armv7s.

Try deleting this framework.. add it once again from sdk 6.0 (target -> build phase)

Mangesh, Since you are updating the project to iOS 6, it is normal that your frameworks go missing some times. In order to add them, please go to build phases and then open the tab Link with binaries and add both the missing files as shows in the screen below.
It should help you add the libraries and you are ready to build it. If you are still facing problems, you can also add the Framework search paths (This will be your local path for the frameworks) for the project under the Build settings. And also please make sure that the framework paths are recursive.

In your .pch file, add the following
#import <SystemConfiguration/SystemConfiguration.h>
#import <MobileCoreServices/MobileCoreServices.h>

sqlite 3 and MobileCoreServices are available with ios 6.
Remove red references
Go in Targets properties -> Build Phases, section Link Binary With Libraries
Click on Add button and add libsqlite3.dylib & MobileCoreServices.framework.
If libsqlite3.dylib is not available in the list. Open your xcodeproj with a text editor then search and destroy hidden references to libsqlite3. And try again.
Vivien

Related

libsqlite3.dylib and libz.dylib missing in Xcode 7. How do I use Parse?

How do I use Parse if libz.dylib and libsqlite3.dylib are missing in Xcode 7 but the .tbd version exists. I am just trying to setup Push Notifications. How do I get this to work?
Also, I think it's because of this I can't import Parse into AppDelegate.swift without an error saying it doesn't exist.
As for Xcode 7 b4:
To add Parse support into existing project, follow the Parse "Set up the SDK" for existing project and to add the libz and libsqlite3 libs, use:
Go to Build Phases > Link Binary with Libraries > + > Add other
While in the file selection window press: "command"+shift+G (i.e. Go to folder) and type /usr/lib/
From /user/lib find and add : libz.dylib and libsqlite3.dylib
Please note!: Also make sure ATS works for you - this is new in iOS9!, see more info for example at NSURLSession "HTTP load failed kCFStreamErrorDomainSSL, -9813 ; Self signing certificate
In tracking down a solution to this on the mac developer forum, this seemed to be the popular answer:
This is a known issue in the Xcode 7 beta. To work around this issue
for now, please: Delete all references to .tbd files from either your
linked libraries phase, or from the copied bundle resources phase
(where they sometimes will be added). Add the library you want to link
manually to the "Other Linker Flags" build settings, by adding the
argument:
-l
for each library you want to link (for example, add "-lsqlite3" (without quotes)). For those who are curious, the .tbd
files are new "text-based stub libraries", that provide a much more
compact version of the stub libraries for use in the SDK, and help to
significantly reduce its download size.
In addition to this, I found that this worked verbatim for the sqlite3 example. But for libz.dylib you simply need to type -lz
And from there I was able to build successfully on the simulator, I have yet checked on a device running iOS9
step 1 (as described by StanislavK):
Go to Build Phases > Link Binary with Libraries > + > Add other
While in the file selection window press: "CMD"+Shift+G (i.e. Go to folder) and type /usr/lib/
From /user/lib find and add : libz.dylib and libsqlite3.dylib
step 2:
open your terminal (for mac)
cd /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/lib
sudo ln -s /usr/lib/libsqlite3.dylib libsqlite3.dylib
sudo ln -s /usr/lib/libz.dylib libz.dylib
That works for me.
I don't think adding dylib files manually is the right way. Parse documentation is not updated for XCode 7: .dylib files are now .tbd files! You can add these files using Build Phases > Link binary with libraries panel and selecting these files from the list, searching for libz and libsqlite3 (without the extension). You can find quick info here about tbd files : Why Xcode 7 shows *.tbd instead of *.dylib?
In XCode 7 the *.dylib files are now *.tbd files, just search for the library you want and change the extension to .tbd
Example:
libz.dylib -> libz.tbd
libstdc++.dylib -> libstdc++.tbd
Thanks

undefined reference for architecture i386 [duplicate]

This problem has been driving me crazy, and I can't work out how to fix it...
Undefined symbols for architecture armv7:
"_deflateEnd", referenced from:
-[ASIDataCompressor closeStream] in ASIDataCompressor.o
"_OBJC_CLASS_$_ASIDataDecompressor", referenced from:
objc-class-ref in ASIHTTPRequest.o
"_deflate", referenced from:
-[ASIDataCompressor compressBytes:length:error:shouldFinish:] in ASIDataCompressor.o
"_deflateInit2_", referenced from:
-[ASIDataCompressor setupStream] in ASIDataCompressor.o
ld: symbol(s) not found for architecture armv7
collect2: ld returned 1 exit status
Command /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc-4.2 failed with exit code 1
I think it has to do with:
ld: symbol(s) not found for architecture armv7
But I have added: libz.1.2.3.dylib and it's not helping, anyone got any ideas?
Common Causes
The common causes for "Undefined symbols for architecture armv7" are:
You import a header and do not link against the correct library. This is common, especially for headers for libraries like QuartzCore since it is not included in projects by default. To resolve:
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. If this is your issue please upvote Cortex's answer below as well.
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.
Original Answer:
You have not linked against the correct libz file. If you right click the file and reveal in finder its path should be somewhere in an iOS sdk folder. Here is mine for example
/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.3.sdk/usr/lib
I recommend removing the reference and then re-adding it back in the Link Binary With Libraries section Build Phases of your target.
I had a similar issue last night and the problem, was related to the fact that I had dragged a class from the Finder to my project in Xcode.
The solution was to go the the Build Phases tab and then the Compile Sources and make sure you drag the class to the list.
I had a similar issue and I had to check "Build Active Architecture Only" on each of the Project configurations (Debug, Release and Deployment) and in the Build Settings of the Target.
Another possible cause of "undefined symbol" linker errors is attempting to call a C function from a .mm file. In this case you'll need to use extern "C" {...} when you import the header files.
Linker error calling C-Function from Objective-C++
I had a similar issue with that. The class name after _OBJC_CLASS_$_ was actually my class. The reason was I didn't tick "Add to Target" when I drag the source code files into navigation list.
My solution was:
delete the class from the navigation list and choose "remove reference only"
drag the source code files again and make sure the tick box for "add to Target" is ticked. The tick box is just under "Copy if needed" and "Create group".
There is usually a alias without the version identifier that is linked to the current version, in this case libz.dylib is linked to libz.1.2.5.dylib. Use the base alias instead of the versioned one.
I had the same problem when I use admob library, I fixed it changing "Architectures" to "Standard architectures armv7, armv7s" without including 64-bit.
Under Target -> Build Settings -> Apple LLVM compiler language:
setting 'C++ Language Dialect' and 'C++ Standard Library' to Compiler default helped solve it.
I only added the libz.1.2.5.dylib to my project and it worked like a charm.
Steps -
Go to Build Phases.
Link Binary With library - use the '+' button to choose frameworks and libraries to add.
Select libz.1.2.5.dylib from the list.
Build and run.
I had a similar issue and saw errors related to "std::"
I changed Build Settings -> Apple LVM 5.0 - Language C++ -> C++ Standard Library
from libc++ (LLVM C++ Standard Library with C++11 support)
to libstdc++ (GNU C++ Standard Library)
If you have the flag -ObjC under your Target > Build Settings > Other Linker Flags and you're getting this issue, consider removing it. If you intentionally added it because you need to load some Obj-C code from a static library that wouldn't normally be loaded otherwise, IE, an Obj-C category, then you should use -force_load <path> instead of -ObjC.
<path> should be relative to your Xcode project directory. IE, if your directory structure looks like this:
iOSProject
+ iOSAPI.framework
+ iOSAPI
+ iOSAPI.xcodeproj
Then you should have this flag set for Other Linker Flags:
-force_load iOSAPI.framework/iOSAPI
If you want to include multiple libraries like that, then you should include a separate -force_load line for each of them.
-force_load iOSAPI.framework/iOSAPI
-force_load another.framework/another
Probably some classes are missing from your target. This usually happens when you rename/remove/add new classes files to your project. To fix add the newly added classes to some targets.
Select the class in the Project Navigator (right sidebar) , open the Utilities sidebar (right sidebar), from the Utilities select the File Inspector (file like icon), under the Target Membership tab tick your targets. This is all to avoid the "Remove reference" and add again with ticking "Add to targets" trick.
So: Select Class -> Utilities (File Inspector) -> Target Membership -> Tick the targets you want.
I have have multiple #interfaces in the .h file and hadn't yet included the all of the corresponding #implementation directives. Make sure that they are all balanced out.
Here's how I got this problem:
I added a .h, .m and NIB from another project by dragging them onto my project navigator. Xcode didn't add them to the Build Phases properly.
Check my answer because I had a similar problem that I was able to solve by doing some steps.
if you're dealing with the iOS5 upgrade, I found that for compiling a project written to target 4.3, I could just rename libz.1.2.3.dynlib in the Project Navigator to libz.1.2.5.dynlib and it compiled.
My iPhoneOS50SDK/usr/lib folder has no libz.1.2.3.dynlib--don't know whether it's a beta thing or just natural upgrade.
Go to your project, click on Build phases, Compile sources, Add GameCenterManager.m to the list.
This fixed my problem: The dependency I am using is not supporting armv7. So I had no other option than to remove it. Armv7 is used for only very old iphones anyway (like iphone 4).
Go 'Build Settings / All'
Set 'Valid Architectures' to 'arm64 arm64e'
I didn't find this suggestion here so here it goes:
if your project has more than one target (ie one for OSX and one for iOS) then you must link the relevant libraries for each target.. so for example in my case I needed AudioToolbox.. I had to add it once for OSX and once for iOS (under the frameworks folder, you must have a duplicate of each library for each target.. if you see only one.. then that's a red flag)
I was facing an issue with PJSIP libraries,
Tried the following in other linker flags in project and able to resolve the error:
-framework
Foundation
-framework
UIKit
Above linker flags are used in Siphone Project over github. These settings will help you resolve problems related to linking of C++ libraries.
Finally i've figured it out, I solved this issue by adding absent framework to target->Build Phases->Link Binary With Libraries
I once had this problem. I realized that while moving a class, I had overwritten the .mm file with .h file on the destination folder.
Fixing that issue fixed the error.
I received the 'Undefined symbols for architecture armv7:' error when trying to compile a project that had the target build setting for 'C++ Standard Library' set to 'libc++' (necessary as the project was using some features from C++ 11), and the project included a sub-project that had the same setting set to 'libstdc++' (or compiler default as it is currently).
Changing the sub-project's 'C++ Standard Library' setting to libc++ fixed it, but only after first setting the deployment target for the sub-project to 5.0 or above (5.0 is necessary for libc++).
I give you more suggestions that you can check when other common suggestions are not help.
If you link with other project(libxxx.a) you might sometimes meet strange problem which you can find the symbol with tools like nm but they just can not find the symbols in ld. Then you should check if the two projects are built in the same flags, some of them may affect the binary format.
check c++ compiler.
check c++ dialect setting.
check c++ runtime type support. (-frtti/-fnortti)
check if there is .a with the same name appears elsewhere, could be beyond the wanted file in the link path list. remove them.
I got this problem when I run app on iphone5s, it was solved by add arm64 to Architectures.
I had the same problem. I tried every thing from the huge list of answer but in the end my problem was:
I'm working with openCV so I need to combine C++ code in my code. To do this you should change the files which use objective-c and C++ to .mm
I didn't changed one file and this file has no connection to the C++ code but I had to change it.
I had this issue, when installing shareKit. It worked in the simulator, but not on the device. I removed -all_load from the Other Linker Flag and everything works fine in both simulator and iphone device.
In my case, I'd added a framework that must be using Objective C++. I found this post:
XCode .m vs. .mm
that explained how the main.m needed to be renamed to main.mm so that the Objective-C++ classes could be compiled, too.
That fixed it for me.
I use to face that issue when the module (file .m) is not in the target that I am working with.
For me the problem was that i forget to set value for my constants in the .m (implementation)
file const kFooKey = #"Foo";
I also added files through Dragging and Dropping. What I did, I removed references of all the files (Excluding frameworks) then added them again properly via Add Files To Project option, problem gone.

Framework not found GoogleMaps sdk in iOS

I want to use google map to existing(not a new one) iPhone project.Now i am using Google map ios sdk and i successfully added google map framework to my project.But i got error like this
ld: framework not found GoogleMaps
clang: error: linker command failed with exit code 1 (use -v to see invocation)
How to solve this issue.I am using xcode4.5 and google map iOS sdk version is 1.5. When i am creating new project with google map iOS sdk then no error getting for me.Error only for existing iOS Project.Please help me.
I solved my issue
You need to do this
Click on your project (targets)
Click on Build Settings
Under Framework search paths (set your framework path)
Following information for getting framework search paths
Right click on your framework folder (for ex: GoogleMaps.framework)
select Get info
copy the path from General->where and paste this path in your framework search path (path should contain in single line)
Good luck
I encountered a scenario in which I had to import a project that was using Google Maps and noticed the same problem - module: "Google Maps" not found.
To solve this problem it was necessary to delete Podfile.lock and Podfile folder and re-install the pods again. Good luck !
You can also :
- remove GoogleMaps from Podfile
- pod install
- add GoogleMaps to your Podfile again
- pod install
This solution works for me, you can also check the search paths a well.
Clean your project. The shortcut is command + shift + k. This will clear information that xcode has stored that might imply that the sdk isn't included.
Also press the project icon at the top of the hierarchy of files, press the target that is your project, press build phases, open link with binary libraries, and make sure that the google maps sdk is in there. If it is not, press + and add it in.
Follow the steps :
Download GoogleMaps-iOS-1.1.0.zip from their site
Unzip the file. You now have a GoogleMaps-iOS-1.1.0 folder
In that folder you have a GoogleMaps.framework folder.
Copy or move the GoogleMaps.framework folder to inside your project folder (in Finder).
Drag the GoogleMaps.framework folder onto your Frameworks group in Xcode.
In the options sheet, uncheck "Copy items into destination group's folder". Make sure your target is checked in "Add to targets". Click OK.
(Note that you can also do this the other way, by not copying it into your project folder and checking "Copy items into destination group's folder". Xcode will copy the folder itself.)
Import using #import "GoogleMaps/GoogleMaps.h". The angle bracket usually work too, but in this case it should use quotes.
From : <GoogleMaps/GoogleMaps.h> file not found Google Maps SDK for iOS
my problem was fixed by adding in:
build settings
Framework Search Paths
clickable and add the following lines:
"${PODS_ROOT}/GoogleMaps/Base/Frameworks"
"${PODS_ROOT}/GoogleMaps/Maps/Frameworks"
If you use Pods
Left menu > Pods > Pods > choose Framework > right menu > copy path from "ios/....."
My: ios/Pods/GoogleMaps/Maps/Frameworks/GoogleMaps.framework
Then Project > Build Setting > Framework Search Path > Click on
$(PROJECT_DIR)/ios/Pods/GoogleMaps/Maps/Frameworks/GoogleMapsCore.framework
Sometimes it happens when you are migrating the code from one system to another so your Framework search paths look empty at this moment, so one simple solution I try is to reinstall the podfile and it works for me.
I've been struggling with this issue for hours; I'm using CocoaPods, Swift and Xcode 6.1.1. I followed all the steps for including GoogleMaps in my project carefully, tried many different things like removing symbolic links in the downloaded package or manually linking the binaries in build phases or trying #include "GoogleMaps.h", #include "GoogleMaps/GoogleMaps.h" and "#include <GoogleMaps/GoogleMaps.h> in my bridge file, none of that worked... Finally used CocoaPods instead of including the framework myself and it worked! Hope it helps someone out there:
In the Podfile:
pod 'Google-Maps-iOS-SDK', '~> 1.9.2'
And in your Bridge file:
#import "GoogleMaps.h"
Delete derived data and delete Podfile.lock file and then run pod install.
Maybe it'll be useful for anybody, next steps helped me:
1. Delete "Headers" and "GoogleMaps" folders manually (from the Finder).
2. Run 'pod install'
3. Re-build the project in Xcode.
In my case, I forgot that I need to open the workspace file with pods, not the project.

Linking Error libxml2.dylib at Xcode 3.2.5 & SDK 4.2

I am trying to connect to twitter using oauth library. The library needs libxml2.dylib to be added. When adding this to SDK 4.1 or less the project build successfully. But when I use that with xcode 3.2.5 and SDK 4.2 I got errors about missing headers
I just add the libxml2.dylib to frameworks then from target configuration I add "${SDKROOT}/usr/include/libxml2" to the header search path.
I got error: libxml/xmlreader.h: No such file or directory.
the twitter oauth library I am trying to add is Twitter+OAuth, here's a tutorial where u can see that the src project it has, works correctly on SDK 4.1, and not even compile at SDK4.2 http://mobile.tutsplus.com/tutorials/iphone/twitter-api-iphone/
what I miss?
After trying several things, I found I have to change the header search path to /usr/include/libxml2/** instead of ${SDKROOT}/usr/include/libxml2/**
Select "All Configurations" (I prefer the project info unless I have very different targets), double-click the header search path field, enter the path and make sure to check the "Recursive" checkbox. The resulting path should have 2 asterisks. If you set the header search path for the project, all the targets should inherit it properly.
The tutorial you linked to is a bit inconsistent with regard to project/target settings, which is almost certainly the issue. I have verified that xmlreader.h is present in SDK 4.2.
I had the same issue, then i realized that i was only adding the header search path in the target section, and not in the project.. be sure that it is in both sides.

CorePlot: how to run on device? (works OK on simulator)

My app uses CorePlot and runs fine on simulator
(it accesses libCorePlot-CocoaTouch.a from:
/Users/myName/core-plot/build/Debug-iphonesimulator ).
To run on device, xcode expects libCorePlot-CocoaTouch.a in:
/Users/myName/core-plot/build/Debug-iphoneos
but that file is missing, so xcode gives error:
'/Users/Giovanni/core-plot/build/Debug-iphoneos/libCorePlot-CocoaTouch.a: No such file or directory'
I tried generating one by doing:
CorePlot-CocoaTouch.proj > set Xcode to build on 'device' > 'Build And Run'
but 'Build and Run' is grayed out.
Copying the simulator version obviously does not work.
Any ideas?
Consider adding CorePlot-CocoaTouch.xcodeproj as a sub-project and then add libCorePlot-CocoaTouch as a dependency.
Try opening the Core Plot project itself and building the framework first. You should build (not "Build and Run") the CorePlot-CocoaTouch target. Do it for each combination of SDK {simulator, device} and configuration {debug, release} (total of four builds). This will create the .a files you need.
After Core Plot is built, go back to your project and build it. It should now link and run correctly.
Check out my answer here if you don't want to use the CorePlot-CocoaTouch.xcodeproj import method (don't need to import the whole project, only the CorePlotHeader folder and the libCorePlot-CocoaTouch.a library file) Fix linker errors for Core Plot when using Xcode 5
Ultimately you might need to delete the old library by right clicking on your MyApp.app file in the Products folder and copy and past the new CorePlot_1.4 .a file into the Debug-iphoneos folder...clean, build, and it should run on an iOS 7 device.
SOLUTION: the issue was CorePlot-CocoaTouch.xcodeproj must also be added as Targets>MyApp>getInfo>DIRECT dependency (in addition to as subproject and in addition to libCorePlot-CocoaTouch being added as Targets>MyApp>getInfo>LinkedLibraries). Thanks