Check with the developer to make sure MyApp works with this version of macOS.
After trying to use ASWebAuthenticationSession, when the App receives the callback, it shows the error:
The same error is showed after an attempt to generate the app and open it.
The error you are seeing is because your code is referring to either a non existing library or is pointing to the wrong directory where your code should look for such library. Please check the rpath you are using. Usually, you should place any dylibs inside a Frameworks folder inside your bundle and thus your rpath should start like this: ../Frameworks/InternalAPI.framework (...)
Related
I'm having several tricky problems with getting my Mac app with CocoaPods to pass validation into the Mac App Store. It works fine running locally but when I validate, it fails with these errors:
App Store Connect Operation Error
Bad Bundle Executable. You must include a valid CFBundleExecutable key in the nested bundle Pods_MSVAPI_macOS [...<stuff>…Contents/Frameworks/MSVAPI.framework/Versions/A/Frameworks/Pods_MSVAPI_macOS.framework] property list file.
App Store Connect Operation Error
Bad CFBundleExecutable. Cannot find executable file that matches the value of CFBundleExecutable in the nested bundle Pods_MSVAPI_macOS [...<stuff>…Contents/Frameworks/MSVAPI.framework/Versions/A/Frameworks/Pods_MSVAPI_macOS.framework] property list file.
(MSVAPI.framework is my own framework that my app uses, which I intend to be cross-platform)
I read this https://developer.apple.com/documentation/bundleresources/information_property_list/cfbundleexecutable and it says "For a framework, it's the shared library framework and must have the same name as the framework but without the .framework extension.". So I tried putting "Pods_MSVAPI_macOS" which is the framework name without the .framework in the "Executable" info entry. No luck.
My next attempt to fix this was to remove the target of Pods_MSVAPI_macos because that's not the actual framework - I have two CocoaPods that I'm using, each which creates its own framework bundle. That worked for getting through validation. But when I came to distribute the app, which I tried locally, it crashed with a "resource not found":
Dyld Error Message:
Library not loaded: #rpath/<podname>.framework/Versions/A/<podname>
Referenced from: /Applications/<appname>.app/Contents/Frameworks/MSVAPI.framework/Versions/A/MSVAPI
Reason: image not found
If I try to add the frameworks directly they are greyed out so it appears that they aren't actually being built independently:
How can I make sure that this CocoaPod's framework (and presumably the other one) gets included in the app bundle, and allow MSVAPI.framework to use it?
Alternatively, how can I get past the CFBundleExecutable validation error at the beginning of my question?
Thanks!
My question is the exact opposite of this earlier one. I am working on an open source application, which is published under 2 forms, pre-compiled binaries and source code.
I installed the pre-compiled binaries and it works perfectly, with a nice little icon in the dock.
I compiled the source code successfully, but I get a runtime error when I launch it. After investigation I suspect this app needs command-line options to run correctly.
So my question is: if my assumptions are correct and the working version is actually defining command line arguments, how can I retrieve the CL arguments from the packaged app?
If it makes any difference, the app I'm talking about is Cyberduck, and I'm running OS X Version 10.8.2
The issue is not the command line. From the code here
// Get an instance of the non-localized keys.
CFDictionaryRef bundleInfoDict = CFBundleGetInfoDictionary(mainBundleRef);
if(NULL == bundleInfoDict) {
fprintf(stderr, "[Launcher Error] No info dictionary.\n");
exit(-1);
}
where mainBundleRef refers to the .app bundle.
The problem is that the Info.plist inside the app (/Applications/Cyberduck.app/Contents/Info.plist) does not have the normal keys in it. It has been corrupted in some way.The one in the code repository looks OK at a glance. For information about the structure I would look at the Apple development document.
The easiest fix would be to redownload and install the application.
I have created a Mac app which uses the RMSharedPreferences framework. When opening the app, it immediately crashes and I get the following error:
Dyld Error Message:
Library not loaded: #rpath/RMSharedPreferences.framework/Versions/A/RMSharedPreferences
Referenced from: /Users/USER/Desktop/MyApp.app/Contents/MacOS/MyApp
Reason: image not found
It seems that it can't find the framework. I have tried adding a copy files phase to the target which should copy the framework and when browsing the contents of the app in Finder, it seems that it is copied correctly.
Does anyone know what might cause this error?
EDIT: Setting the framework to optional does make the application launch without any errors but the application does not fully work. Any RMSharedPreferences related calls will be ignored.
Since you are bundling the framework with your app, you should set the framework's install location. You can set that in your framework target build setting "installation location". Use something like:
#executable_path
You could also use a separate folder for your frameworks, then you would use:
#executable_path/../Frameworks/
In case you can't rebuild the framework (which is not yours, but I am saying in general), you can modify a prebuilt framework installation path like this:
install_name_tool -id #executable_path/../Frameworks/<framework_name> <your_framework>
Here you can find a reference for this.
If you are going to bundle a framework inside another framework, you can use #loader_path instead of #executable_path.
#rpath is a more flexible keyword, and its use is recommended.
The better way to do this is to set the "Runpath Search Paths" build setting in Xcode.
This avoids the need for an additional build phase script to modify the framework.
For instance, in your situation, you could set "Runpath Search Paths" to
#executable_path/../Frameworks
or
#loader_path/../Frameworks
if you're trying to load the framework from within a framework.
I have written a simple application using the GPhoto2 Framework, and this works so long as the framework is in the location where it was originally compiled. I would like to move this inside the app bundle, though, so it does not need separate installation, so I need to make it work relative to this main executable.
Unfortunately the framework is not an Xcode project. It uses a script to build, so I cannot simply change the installation directory build setting, which is the solution that I have frequently seen while searching for an answer. Being quite new to Xcode and Mac programming it is also beyond my abilities to know how to convert the framework into an Xcode project.
The other advice I came across was to use install_name_tool to update the library ID and dependencies, replacing the absolute paths with ones of the form "#executable_path/../Frameworks/GPhoto2.framework". The framework is not a single binary, but contains a number of .dylib and .so libraries, but updating all of these has only been half successful.
I have set Xcode to copy the framework into the app bundle when it builds it. Then if I remove the framework from its originally compiled location the application fails to load, with the report generated by OS X saying the libgphoto2 library can no longer be found, as to be expected.
If I then use install_name_tool to update the references in all of the framework libraries inside the app bundle, and also in the app binary itself, then the application will load but fails to find any camera connected. Using otool I am able to verify that all references have correctly been changed.
But if I replace a copy of the framework to its original location it then works properly again, recognizing connected cameras, regardless of whether that framework uses relative or absolute locations. Clearly it is still looking at this location despite loading. I have even tried removing each of the individual library files from the framework in its original location in turn to see if the problem was just the result of a dependency in of these, but no matter which is missing the app will not work.
Incidentally, if I build the app using an updated version of the framework, it fails saying it cannot find the library "#executable_path/../Frameworks/GPhoto2.framework/prefix/lib/libgphoto2.2.dylib"
Am I doing something wrong or missing a step, or is what I am trying to do impossible for frameworks created outside Xcode?
In case someone comes across this future, the answer to my question was that I was doing nothing wrong. The problem was that the .so files were being loaded by libtool ltdl, at it requires absolute paths so these were being set at build time.
I patched the files gphoto2-abilities-list.c and gphoto2-port-info-list.c so that at runtime it would combine the relative library paths with the executable location. As a result I also needed to increase the FILENAME_MAX constant to allow it the mail application to run from, for example, the Desktop. But this, along with the use of install_name_tool allowed me to add GPhoto2 as a framework inside my application without needing any external dependencies.
The final problem of not being able to build my app in XCode with the framework after using install_name_tool remained, but for that I just used the original framework build, then after compilation I updated the references in the copied framework at the same time as I updated the ones in the main executable.
RubyMotion provides these instructions for vendoring 3rd party code: http://www.rubymotion.com/developer-center/guides/project-management/#_files_dependencies
I'm trying to add Parse.com's iOS SDK. These are the instructions for adding it to an XCode project: https://parse.com/apps/quickstart#ios/existing. However, I'm not using XCode since I'm working with RubyMotion.
I documented my attempt here: https://github.com/adelevie/RubyMotionSamples/commit/603bf4428995bb203cce7e7e8e6989d6e86bda3b
And here are the errors I'm getting: https://gist.github.com/2595284
I believe we're actually dealing with a static library here, so I believe you should specify :static instead of :Xcode as the second option.
With the following code in your Rakefile, the app compiles:
app.libs << '/usr/lib/libz.1.1.3.dylib'
app.frameworks += [
'AudioToolbox',
'CFNetwork',
'SystemConfiguration',
'MobileCoreServices',
'Security',
'QuartzCore']
app.vendor_project('vendor/Parse.framework', :static,
:products => ['Parse'],
:headers_dir => 'Heiders')
However, I'm getting the following error running the Parse setApplicationId method:
(main)>> Objective-C stub for message `setApplicationId:clientKey:' type `v#:##' not precompiled. Make sure you properly link with the framework or library that defines this message.
The documentation linked says, "To vendor a 3rd-party library in a RubyMotion project, the source code must be available somewhere on the filesystem." So I don't think dropping a .framework file in there will work.
You could try downloading the ParseStartProject, called "Blank Xcode w/ SDK" from parse.com/docs. If you vendor that project folder, RubyMotion will be able to find an xcode project like it's looking for. You'll want to delete the .m and .h files from the xcode project, of course, since you only want the project to include Parse.framework.
I haven't actually tried this. Please let us know if you get it working.
Okay copied this from an answer in the RubyMotion group. It seems to fix the stub error message:
Now, to make this work, I've modified /Library/RubyMotion/lib/motion/project/vendor.rb and changed the Dir.glob on line 38 from:
source_files = (opts.delete(:source_files) or Dir.glob('*.
{c,m,cpp,cxx,mm,h}'))
to:
source_files = (opts.delete(:source_files) or Dir.glob('**/*.
{c,m,cpp,cxx,mm,h}'))
http://groups.google.com/group/rubymotion/msg/0efa74214523d0f5