What will happen if a framework get deleted from an app? - objective-c

I was asked a question, what will happen when a framework is accidentally deleted from your device may be iphone or mac?
Whether your application crash or it will work without any error?
Please provide me answer with explainations.

You may get linking error. If framework folder is inside the application means its runtime linking.
OS X embeds an "install name" inside each dynamic library. This
install name is the path to where the library can be found when dyld
needs to load it. When you build an application that links against a
dynamic library, this install name is copied into the application
binary. When the application runs, the copied install name is then
used to locate the library or framework.
$ otool -D /Applications/Google\ Drive.app/Contents/Frameworks/Python.framework/Versions/2.6/Python
/Applications/Google Drive.app/Contents/Frameworks/Python.framework/Versions/2.6/Python:
#executable_path/../Frameworks/Python.framework/Versions/2.6/Python
so if you will delete Frameworks folder you will get Dyld Error.
Dyld Error Message:
Library not loaded: #loader_path/../Frameworks/Sparkle.framework/Versions/A/Sparkle
Referenced from: /Applications/Transmission.app/Contents/MacOS/Transmission
Reason: image not found

If a framework is deleted, only software linking to that framework would be affected.
If it is a system framework, expect your system to start failing.
If it is a 3rd party framework, it should be limited in scope of impact.
If it is in your app bundle, and your app is code-signed, the removal of the bundled framework should prevent your app from launching.

It depends on if the application needs access to the framework you have removed.
If you application requires the framework then it will not compile.
If you dont need it, it will just compile like normal.

Related

Missing dll files in my app when using ffmpeg libs (dll)

I have built ffmpeg v3.2.4 shared libraries (dll) in windows 8.1, core i-7, using mingw-64 and msys2.
The reason was to update my old libraries that were used in my project.
The build was OK.
Also, my application has successfully linked with those dll's.
However, when I am running my app, I got a message program can't start because libiconv-2.dll is missing in your computer. I overcome this issue by adding --disable-iconv switch in configure before running make to build the ffmpeg libs from sources.
Then I got the same message with zlib dll missing. Then added --disable-zlib switch.
But then, I got libbz2-1.dll is missing when running the app. I don't know how to solve the last one, but, what am I missing here? Why didn't I need all these dll file in the old ffmpeg version (0.7.17) and now I do (latest ffmpeg (checked out tag n3.2.4)) ??
Thanks for the answers,
Aviv

Is there any DSYM file for .framework (besides app)?

I am a new guy in OC programming. Now I am involved in a framework development project.
I know the framework works as a library, which contains a group of methods. It's not an application that can run on devices.
Actually, our framework will work with customer's application. We want to investigate what happened inside our framework when customer's application crashed. So I want the 'DSYM' file of our framework, instead of an application.
As far as I know any iOS application does have corresponded 'DSYM', but I didn't find the 'DSYM' of our framework.
Does iOS framework project have 'DSYM'? If it does have, how can I obtain it?
By the way, I am using Xcode 8.1.
Thanks!
According to my observations, .dSYM files are generated for iOS dynamic framework built with Release configuration only.
After build succeeds, the debug symbols files can be found at these paths, for a device and simulator, respectively:
<Build_Root>/build/Release-iphoneos/<Product_Name>.framework.dSYM
<Build_Root>/build/Release-iphonesimulator/<Product_Name>.framework.dSYM
, where
<Build_Root> is usually a subdirectory within Derived Data directory;
<Product_Name>is the name of your framework.
Yes, you can generate dSYMs for dynamic frameworks. There are a few relevant build settings that control whether and where these files are generated:
DEBUG_INFORMATION_FORMAT = dwarf-with-dsym,
DWARF_DSYM_FOLDER_PATH = "$(CONFIGURATION_BUILD_DIR)",
DWARF_DSYM_FILE_NAME = "$(PRODUCT_NAME).dSYM"
Obviously, you can set these to whatever you want, either in your project's build settings in Xcode (the project.pbxproj file) or as arguments to xcodebuild (depending on how you generate your framework).
DSYM (Debugging SYMbols) files generally store the debugging symbols for your app. And if app crash any where symbols replaced with appropriate method name so that it could help developer in a readable form. And for that you can use the crash log and they can be find in the iPhone where the app is installed. Each app and device have their own crash log.
Also please check this link it might help you.
Read Crash Report
Upload Symbols for iOS Framework
Hopefully these might help you or guide in the right direction.

.app file not working in other MAC system

I have created a MAC application with libraries 'libmysqlclient.a' and 'libmysqlclient.18.dylib' with Objective-C language in Xcode 6.3.1 in OSX Yosemite 10.10.3. Its working fine when running through Xcode. And I also archived the .app file to install the app in my MAC, its also working fine. But when i tried to install it in another mac, app crashed and shows the message
"dyld: Library not loaded: libmysqlclient.18.dylib Referenced from: /Users/developer/Documents/UntitledFolder/UserName/SampleApp.app/Contents/MacOS/SampleApp Reason: image not found".
From this message i understand that the particular MAC does not have “libmysqlclient.18.dylib”. So, here my question is "Is it mandatory that each MAC should have the library to install and run the application?". Can anyone give me the solution for this with detailed format of creating the .app file and installing it in other MAC systems.
Thanks in Advance.
You have included both a static (.a) and a dynamic (.dylib) library with your app. that do the same thing. A static library compiles into your program, making it larger. A dynamic library ships with your app. or is already install on your target system. If you ship it with your app., it should be in the Frameworks folder of your app. (you create this folder in Build Phases, Copy File). Use install_name_tool -id to set the library install name to #executable_path\..\Frameworks and also in Build Settings, set Runpath Search Paths to the same.

Dyld Error Message: Library not loaded: /usr/lib/libusb-1.0.2.dylib OSX

I am trying to release an app for OSX but every time someone runs the app on their machine they get:
Dyld Error Message:
Library not loaded: /usr/lib/libusb-1.0.2.dylib
Referenced from: /Users/USER/Desktop/____.app/Contents/MacOS/____
Reason: image not found
The guy on this post suggests it is the path that the package was built with Dyld: Library not Loaded Error Mac OS
But even if I build the app with no prefix I still have the issue.
Then I tried to build using:
./configure --disable-dependency-tracking --disable-static --prefix=#executable_path/../Frameworks/
But that gave a error of an invalid path. I am including the dylib in the package. I have to use libusb 1.0.16RC10 because there is a bug in the newest stable release that breaks mouse and keyboard functionality on the MBP for a short period of time ever time you scan for devices.
Please tell me there is a way to have it included that every use doesnt have to compile their own libUSB.
So if you're including your .dylib within the framework directory, now you just need to run the "install_name_tool" to point your app to that dylib within the application package, instead of "/usr/lib".
To do this, add a "Run Script" build step after the compiling and linking has finished. And in this build phase, the script will be as simple as:
install_name_tool -id #executable_path/../Frameworks/libusb-1.0.2.dylib path/to/your/project/libusb-1.0.2.dylib
The tutorial I'm looking at can be found here. I hope this helps you out!

How do I build an app and framework on OS X 10.6 that can run on 10.5?

Here's my situation: I have the source code for a third-party framework that I want to include in my project. I'm developing on 10.6 but I want to support 10.5, so I have the base SDK and the deployment target set to 10.5.
I can build the framework and the application, and the app runs inside Xcode and on the machine. However, it fails on a 10.5.8 and crashes. The crash report says
Unknown required load command 0x80000022
I have also tried building the framework on the 10.5.8 machine, setting the architecture to '32/64-bit Universal'. Moving this framework to the 10.6 machine and attempting to build the app works, but the app fails to run, throwing multiple errors of:
-[NSCFArray matchAndAssemble:]: unrecognized selector sent to instance 0x3503c0
Has anyone seen this before? Do you know of a fix or workaround? It can't be an uncommon situation.
The loader command being flagged is the loader command for a compressed binary which is a binary type supported only on 10.6.
matchAndAssemble: is not a (documented) method of NSArray/NSMutableArray. It is, however, a method of the PKParser kit. Is that the framework you are trying to build?
Anyhow, something in your project is being built only for 10.6 and it's probably that framework. Check the build settings for all of your targets, and any targets of any sub projects and do an otool -l on any third party frameworks to look for the 22 load command.
Answer for the first error: unable to read unknown load command 0x80000022 - Stack Overflow, and it might have a bearing on the second error. What version Xcode and SDK are you using?