Loading Growl in my Mac app: Unable to read symbols - objective-c

I am trying to load Growl so I can use it in my Mac app, but I keep getting this error:
warning: Unable to read symbols for #executable_path/../Frameworks/Growl.framework/Versions/A/Growl (file not found)
warning: Unable to read symbols from "Growl" (not yet mapped into memory).
What does this mean and how can I fix this problem?

I guess there is a step I missed. Don't forget to do these steps:
Download the Growl framework from the Downloads page.
Copy the Growl framework to your application's project folder (or any subdirectory of it).
Add the Growl framework to your project, making sure that all the relevant target checkboxes are checked. The header files in the framework use UTF-8 encoding.
Add a Copy Files phase to your application's target (App target > Build Phases > Add Build Phase).
Get Info on the Copy Files phase.
Set the destination to “Frameworks”, with no subpath (clear the field).
Drag the framework from the group tree into the Copy Files phase.
From now on, your application will compile and link using the Growl framework inside its bundle.

Make sure you have the latest version of Growl installed on your machine, as well as the latest framework (build the Growl framework project that your app is using).

Related

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.

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

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.

bundle dylib with application

I'm running Xcode 4.5 and MacOS 10.7.4 and trying to create a MacOS app for local distribution.
I have a dylib from a 3rd party USB hardware vendor. Rather than drop this into /usr/lib, I wanted to bundle this with the app. I have tried all of the methods mentioned here that I could find:
Creating a Cocoa Library target, and using a copy build phase, setting paths with #rpath and #executable_path and #loader_path ...
Here's what I ran into:
I can get the target app to build to compile and run if the dylib is copied into the same directory as the target app (by setting destination to "Products Directory"), however this only works while the app is running within Xcode. If I run the app from the finder it still looks for the dylib at /usr/lib.
A caveat when changing the destination setting: any files copied to a location in the previous build are not deleted when you make a change a build again. This tricked me into thinking a few times that I had a solution when I didn't.
"Library search paths" appears to work as expected when linking, but setting "Dynamic Library Install Name" and "Runpath search paths" don't appear to stop the code from looking in /usr/lib only at run time. They don't seem to have any effect at all.
So, why would setting those path variables have no effect, and how can I set the run time search path?

Linking to library

I installed ImageMagick through MacPorts. So all library files are in /opt/local/lib and headers in /opt/local/include/ImageMagick. It works OK on my mac. In xCode Build Settings - > Search Paths everything looks to be set OK.
Added library files to Linked Frameworks and Libraries
When I build my app it looks to be working. But when I try to run builded app on other computer where ImageMagick is not installed there comes this error message:
How can I fix it to make users to be able use my app without needing to additionally install ImageMagick and so on? How to link it that needed library files would come with my app (in project bundle)?
Af of now your linking library is referred from /opt/local/lib/ ---
Solution for your issue:
Make sure where ever app is installed suport library is installed to right location
Carry the dynamic library with app bundle and refere the dyld from the app bundle which will be relative to app bundle launch path.
Update: If you are looking for the second option --- With this option your library will be placed inside your app bundle ... so app can refer the library from the app bundle.
The precompiled dynamic library can be carried with the application -- in xCode --> Go to Build Phases for the target --> Build Phase (copy files) ... this will make sure your dynamic library is copied to into your app bundle ...
Update “install name” inside each dynamic library --- You can use 'otool' command to know present install path of your precompiled library and you can precompiled library install path using'install_name_tool' command in your terminal.
No support for it from ImageMagick forum, no support from StackOverflow, so I guess its impossible...

Adding a framework to XCode 4

of course i did research before posting my question.
I looked at
How to "add existing frameworks" in Xcode 4?
Adding Framework in Xcode 4
Adding an OpenGL framework in Xcode 4
XCode 4 adding dylib
but whole thing is becoming wrong.
My goal: Add (CorePlot) framework to XCode Mac project (not an iPhone one)
My environment: OSX Lion 10.7, SDK Lion, XCode 4.1 (4B110)
My steps:
Opened XCode, created new project
Downloaded CorePlot into my libraries directory (like ~/Applications/LIBS)
Opened project preferences, via (+) opened dialog to add framework
Add existing framework (+ copy files to dest. group if needed)
Selected directory was ~/Applications/LIBS/CorePlot/Binaries/MacOS/CorePlot.framework/
DnD CorePlot to Frameworks Group
Added CorePlot to Build Phases > Link Binary with Libraries
and ran my project
what I got is this error message:
dyld: Library not loaded: #loader_path/../Frameworks/CorePlot.framework/Versions/A/CorePlot
Referenced from: /Users/username/Library/Developer/Xcode/DerivedData/metralight-hjuvuwlhgohrtdeepvcymnsaxomc/Build/Products/Debug/metralight.app/Contents/MacOS/metralight
Reason: image not found
And in fact, when I looked into given directory (app bundle) there was no directory Frameworks and so the linking cannot be successful
I have searched one more, and found, that I can create Build Rule and copy files into final binary bundle via some script, but is this only way how to do this?
Isn't there some option to just turn on/off copying linked frameworks to final bundle?
Note that CorePlot target '.framework' has Dynamic Library Install Name set to #loader_path/../Frameworks/CorePlot.framework/Versions/A/CorePlot, so it is looking in right place in final binary bundle
After adding framework via "Add existing framework"
Go to Project Settings > Build Phases
In right bottom corner click Add buid phase > Copy Files
Select Destination > Frameworks
Drag&Drop framework to files list
And that's it.
Another important detail here - you must have the "Runtime search path" to be defined in the projects, it's empty by default.
Something like this:
LD_RUNPATH_SEARCH_PATHS = #loader_path/../Frameworks