Mac File association not working. Why or how to debug? - macos

I have the following Info.plist which I am attempting to associate .mybin files with the applcation. However after installing the .mybin files do not have the icon, the description or the association (when viewing with Get Info). I'm completely new to OSX development and I inherited the packaging of the application so I have no idea how to debug problems. The app is packaged to a .app using productbuild if that makes any difference.
I have compared my info.plist against several other applications and the only difference I can see is many include deprecated keys such as CFBundleTypeExtensions. Since I only need to support 10.6 and greater I don't believe I need this and LSItemContentTypes should be enough. From what I understand the 'com.me.myapp.mybin' of LSItemContentTypes is the link to the exported UTI of the same name.
I have tried manually associating the .mybin file with the application, but that fails when I double-click saying the app does not handle that type of file.
Can anyone tell we what is wrong with this info.plist or what to do investigate?
Thanks.
<plist version="1.0">
<dict>
<key>CFBundleIconFile</key>
<string>MyApp.icns</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleGetInfoString</key>
<string>My Application version 1.0, Copyright © 2013.</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleExecutable</key>
<string>My Application</string>
<key>CFBundleName</key>
<string>My Application</string>
<key>LSMinimumSystemVersion</key>
<string>10.6</string>
<key>CFBundleIdentifier</key>
<string>com.me.myapp</string>
<key>CFBundleDisplayName</key>
<string>My Application</string>
<key>CFBundleVersion</key>
<string>1.0.0</string>
<key>CFBundleShortVersionString</key>
<string>1.0.0</string>
<key>LSMultipleInstancesProhibited</key>
<true/>
<key>CFBundleDocumentTypes</key>
<array>
<dict>
<key>CFBundleTypeIconFile</key>
<string>MyApp</string>
<key>CFBundleTypeName</key>
<string>My Application binary</string>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
<key>LSItemContentTypes</key>
<array>
<string>com.me.myapp.mybin</string>
</array>
<key>LSHandlerRank</key>
<string>Owner</string>
</dict>
</array>
<key>UTExportedTypeDeclarations</key>
<array>
<dict>
<key>UTTypeConformsTo</key>
<array>
<string>public.data</string>
</array>
<key>UTTypeDescription</key>
<string>My Application binary</string>
<key>UTTypeIconFile</key>
<string>MyApp.icns</string>
<key>UTTypeIdentifier</key>
<string>com.me.myapp.mybin</string>
<key>UTTypeTagSpecification</key>
<dict>
<key>public.filename-extension</key>
<string>mybin</string>
<key>public.mime-type</key>
<string>application/vnd.me-app.binary</string>
</dict>
</dict>
</array>
</dict>
</plist>

You could investigate using the lsregister command:
alias lsregister='/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister'
lsregister -lint -f /path/to/your.app
(I'm using Lion. On a different version of the Mac OS, it's possible that the path to lsregister is different.)

Related

Error-> Reading plist: The data couldn’t be read because it isn’t in the correct format

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>NSPhotoLibraryUsageDescription</key>
<string>This app requires access to the photo library</string>
<key>NSCameraUsageDescription</key>
<string>This app requires access to the camera</string>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleDisplayName</key>
<string>kangaroohop</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>2</string>
<key>NSLocationWhenInUseUsageDescription</key>
<string>This app needs to access your location.</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSExceptionDomains</key>
<dict>
<key>localhost</key>
<dict>
<key>NSExceptionAllowsInsecureHTTPLoads</key>
<true/>
</dict>
</dict>
</dict>
<!-- <key>NSLocationWhenInUseUsageDescription</key> -->
<true/>
<key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
<true/>
<string/>
<key>UILaunchStoryboardName</key>
<string>LaunchScreenIntracept</string>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>armv7</string>
</array>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>
<key>UIAppFonts</key>
<array>
<string>AntDesign.ttf</string>
<string>Entypo.ttf</string>
<string>EvilIcons.ttf</string>
<string>Feather.ttf</string>
<string>FontAwesome.ttf</string>
<string>FontAwesome5_Brands.ttf</string>
<string>FontAwesome5_Regular.ttf</string>
<string>FontAwesome5_Solid.ttf</string>
<string>Fontisto.ttf</string>
<string>Foundation.ttf</string>
<string>Ionicons.ttf</string>
<string>MaterialCommunityIcons.ttf</string>
<string>MaterialIcons.ttf</string>
<string>Octicons.ttf</string>
<string>SimpleLineIcons.ttf</string>
<string>Zocial.ttf</string>
</array>
</dict>
</plist>
I have been trying to build my app using Xcode and it is giving me this error. I have tried different other solutions which are previously mentioned on StackOverflow, but I cannot get rid of this error.
-> I am using the latest version of Xcode 12.5
-> My React Native version is 0.64.0
-> My info.plist file is :
To solve you can copy/paste the XML into a template project.
The problem is that you have made some handmade edits to comment out a key-value pair and made invalid XML
Delete from line 44-48 to fix. The segment should be:
<!-- <key>NSLocationWhenInUseUsageDescription</key>
<true/>
<key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
<true/>
<string/> -->
not
<!-- <key>NSLocationWhenInUseUsageDescription</key> -->
<true/>
<key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
<true/>
<string/>
That will solve your immediate issue. From there you can add strings for the two keys in the Xcode editor.

Codesign without xcode - error code object is not signed at all

I have a macOS .app developed in a non-xcode tool. I want to sign it, so users can download from my website.
I have manually created my "info.plist" file which looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleExecutable</key>
<string>mydemo</string>
<key>CFBundleName</key>
<string>md</string>
<key>LSApplicationCategoryType</key>
<string></string>
<key>CFBundleIdentifier</key>
<string>com.company.mydemo</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleSignature</key>
<string>md</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>CFBundleIconFile</key>
<string>mydemo.icns</string>
<key>CSResourcesFileMapped</key>
<true/>
<key>CFBundleDocumentTypes</key>
<array>
<dict>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
<key>CFBundleTypeExtensions</key>
<array>
<string>*</string>
</array>
<key>CFBundleTypeOSTypes</key>
<array>
<string>fold</string>
<string>disk</string>
<string>****</string>
</array>
</dict>
</array>
<key>NSHighResolutionCapable</key>
<true/>
</dict>
</plist>
I have an Apple developer account and in
https://developer/apple/account/mac/certificate followed instructions for creating a Developer ID application certificate.
I am now doing this
codesign -s "Certificate Developer ID Company Name" mydemo.app
but get error
mydemo.app: code object is not signed at all In subcomponent:
mydemo.app/Contents/info.plist
My .app file does noy contain in additional lib - just executable mydemo.app/Contents/MacOS/mydemo
I would like to successfully sign mydemo.app. I distribute my app in mydemo.zip and my goal is that when people download. unzip and drag it into /Applications it will run more easily
The info.plist filename should be capitalized:
Info.plist
It should codesign without issue after correcting it.

Open existing file in OSX with RCP and register file type

I'm working on installers for a tool written in Java/Ecipse RCP and everything is working except two things I think could be related:
1) Open existing file. For some reason OSX doesn't provide the selected file as an argument like windows and linux does. How do I get osx to pass the path as an argument? or is there another way?
2) File type doesn't register properly. Double clicking an existing file with the extension opens the application as expected, but when I go "Open with" - "Other" the tool is greyed out, how do I make osx understand that the tool can open such files?
Here's the current Info.plist:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleIconFile</key>
<string>images/icons/macos.icns</string>
<key>NSHumanReadableCopyright</key>
<string>2016 Company</string>
<key>CFBundleGetInfoString</key>
<string>Tool description</string>
<key>CFBundleShortVersionString</key>
<string>1.2.0</string>
<key>CFBundleVersion</key>
<string>1.2.0</string>
<key>CFBundleDisplayName</key>
<string>Tool</string>
<key>CFBundleName</key>
<string>com.company.tool</string>
<key>LSApplicationCategoryType</key>
<string>public.app-category.utilities</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleExecutable</key>
<string>tool</string>
<key>CFBundleIdentifier</key>
<string>com.company.tool</string>
<key>UTExportedTypeDeclarations</key>
<array>
<dict>
<key>UTTypeIdentifier</key>
<string>com.company.tool.extension</string>
<key>UTTypeTagSpecification</key>
<dict>
<key>public.filename-extension</key>
<string>ext</string>
</dict>
<key>UTTypeIconFile</key>
<string>images/icons/macos.icns</string>
<key>UTTypeDescription</key>
<string>tool file</string>
</dict>
</array>
<key>CFBundleDocumentTypes</key>
<array>
<dict>
<key>CFBundleTypeIconFiles</key>
<string>images/icons/macos.icns</string>
<key>CFBundleTypeName</key>
<string>tool file</string>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>LSHandlerRank</key>
<string>Owner</string>
<key>LSItemContentTypes</key>
<array>
<string>com.company.tool.extension</string>
</array>
</dict>
</array>
</dict>
</plist>

canOpenURL: failed for URL: "fbauth2:/" - error: "(null)"

Must say this error is driving me nuts and I am at my wits end. I would like to say that I've read through tons of articles on how to fix this error, I've implemented the solutions given, and this error is still here.
Here is some information on what I am using
Facebook iOS sdk v4.7.1
Parse iOS sdk 1.9.1
Xcode Version 7.1.1
Swift 2.1
I have seen all sorts of solutions regarding the plist, i have updated my plist many times over with, to my knowledge, the proper credentials. Here is my entire plist:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.9.1</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLSchemes</key>
<array>
<string>fb1679166828968529</string>
</array>
</dict>
</array>
<key>CFBundleVersion</key>
<string>1.9.1</string>
<key>FacebookAppID</key>
<string>1679166828968529</string>
<key>FacebookDisplayName</key>
<string>Student Kitchen</string>
<key>LSApplicationQueriesSchemes</key>
<array>
<string>fbapi</string>
<string>fb-messenger-api</string>
<string>fbauth2</string>
<string>fbshareextension</string>
</array>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSExceptionDomains</key>
<dict>
<key>akamaihd.net</key>
<dict>
<key>NSExceptionRequiresForwardSecrecy</key>
<false/>
<key>NSIncludesSubdomains</key>
<true/>
</dict>
<key>facebook.com</key>
<dict>
<key>NSExceptionRequiresForwardSecrecy</key>
<false/>
<key>NSIncludesSubdomains</key>
<true/>
</dict>
<key>fbcdn.net</key>
<dict>
<key>NSExceptionRequiresForwardSecrecy</key>
<false/>
<key>NSIncludesSubdomains</key>
<true/>
</dict>
</dict>
</dict>
<key>UIMainStoryboardFile</key>
<string>Main</string>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>armv7</string>
</array>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
</dict>
</plist>
I have the proper skds for both Facebook and Parse imported into my project. In both my AppDelegate.swift file and the Viewcontroller.swift file i have imported the following at the top.
import UIKit
import Parse
import ParseFacebookUtilsV4
import FBSDKCoreKit
import FBSDKLoginKit
I have turned bitcode off. I have done everything i've read and this error still persists. Any help would be greatly appreciated.
I also would like to note that i am aware Facebook says this is an error that can be ignored. However this does not apply in my case. I am trying to launch the Facebook login screen to log into my app with, and the simulator starts up and goes to a white screen immediately, it does not switch to the Facebook login because of this error which is why i can't ignore it. I also can not try to run the app on my phone as it is an iPhone 4 and is running iOS 7 and i am trying to ensure this works for iOS 9. Also downgrading versions in either Facebook or parse sdks is not an option.
I have also reset the content and settings of the simulator multiple times.
Thank you in advance to whoever can help, i have seen many people with the same error but no proper solution, and I am sure they will all be grateful as will I.

CFBundleTypeIconFile Icon not showing for given file extension

I have the following Info.plist for my application, the problem is files i save with the extension myapp do not seem to pick up on my MyApp icon which i have created from an icon set (application correctly uses icon) so guessing there is something wrong in the plist.
I am assuming if I got this working when running my application at some point documents that I have save will suddenly show with the given icon.
Incase this matters, the document is saved from a set of NSCoder based classes. Clicking these documents also opens my application and loads the file correctly, so confused what I am missing to get Icon to show on the files....
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleDocumentTypes</key>
<array>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>myapp</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>MyApp</string>
<key>CFBundleTypeOSTypes</key>
<array>
<string>ASWM</string>
</array>
<key>CFBundleTypeName</key>
<string>MyApp project file</string>
<key>CFBundleTypeRole</key>
<string>Editor</string>
</dict>
</array>
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleIconFile</key>
<string>MyApp</string>
<key>CFBundleIdentifier</key>
<string>com.workmonkeys.${PRODUCT_NAME:rfc1034identifier}</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>${PRODUCT_NAME}</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>ASWM</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>LSApplicationCategoryType</key>
<string>public.app-category.developer-tools</string>
<key>LSMinimumSystemVersion</key>
<string>${MACOSX_DEPLOYMENT_TARGET}</string>
<key>NSHumanReadableCopyright</key>
<string>Copyright © 2012 Me. All rights reserved.</string>
<key>NSMainNibFile</key>
<string>MainMenu</string>
<key>NSPrincipalClass</key>
<string>NSApplication</string>
</dict>
</plist>
Turns out the system must have cached a old copy of the plist when I initially created my application. All that was needed was to rebuild the launch services database.
I used the lsregister command as documented here...
http://www.tuaw.com/2009/06/11/terminal-tips-rebuild-your-launch-services-database-to-clean-up/
Rerun the application and bingo the documents now have the respective icon associated.

Resources