MacOS: Dropping a file on the dock icon – Project with and without storyboard
What I want to achieve is to drop files on the app's dock icon. It's well understood how to do it, no questions there. I tried to make it work with my existing project, but the icon does not get dimmed and the AppDelegate
would not get called.
So I created another project and it worked out of the box.
What my question boils down to: If I generate a new macOS project with Storyboards, this just works. If I generate a new project without checking the Storyboards box, it doesn't.
Is there something I miss? It's basically solved: I just generated a new project, moved all of the code and assets - done. But I'd like to understand the issue :-)
The Info.plist looks like this in both cases:
<?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>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleDocumentTypes</key>
<array>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>*</string>
</array>
<key>CFBundleTypeName</key>
<string>AllFiles</string>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
</dict>
</array>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIconFile</key>
<string></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>CFBundleVersion</key>
<string>1</string>
<key>LSMinimumSystemVersion</key>
<string>$(MACOSX_DEPLOYMENT_TARGET)</string>
<key>NSHumanReadableCopyright</key>
<string>Copyright © 2018 Wukerplank. All rights reserved.</string>
<key>NSMainStoryboardFile</key>
<string>Main</string>
<key>NSPrincipalClass</key>
<string>NSApplication</string>
</dict>
</plist>
The only difference of course is
<key>NSMainStoryboardFile</key>
<string>Main</string>
vs
<key>NSMainNibFile</key>
<string>MainMenu</string>
(Xcode 10.1, macOS Mojave)
xcode macos cocoa xcode10.1
|
show 1 more comment
What I want to achieve is to drop files on the app's dock icon. It's well understood how to do it, no questions there. I tried to make it work with my existing project, but the icon does not get dimmed and the AppDelegate
would not get called.
So I created another project and it worked out of the box.
What my question boils down to: If I generate a new macOS project with Storyboards, this just works. If I generate a new project without checking the Storyboards box, it doesn't.
Is there something I miss? It's basically solved: I just generated a new project, moved all of the code and assets - done. But I'd like to understand the issue :-)
The Info.plist looks like this in both cases:
<?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>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleDocumentTypes</key>
<array>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>*</string>
</array>
<key>CFBundleTypeName</key>
<string>AllFiles</string>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
</dict>
</array>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIconFile</key>
<string></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>CFBundleVersion</key>
<string>1</string>
<key>LSMinimumSystemVersion</key>
<string>$(MACOSX_DEPLOYMENT_TARGET)</string>
<key>NSHumanReadableCopyright</key>
<string>Copyright © 2018 Wukerplank. All rights reserved.</string>
<key>NSMainStoryboardFile</key>
<string>Main</string>
<key>NSPrincipalClass</key>
<string>NSApplication</string>
</dict>
</plist>
The only difference of course is
<key>NSMainStoryboardFile</key>
<string>Main</string>
vs
<key>NSMainNibFile</key>
<string>MainMenu</string>
(Xcode 10.1, macOS Mojave)
xcode macos cocoa xcode10.1
Is it because the storyboard architecture gives you a window controller?
– matt
Nov 15 '18 at 22:09
I still don't get it, @matt :-/ I moved all of my code, got rid of the storyboard, the whole project looks like the original one. The only difference is that dropping files on the app icon works now. I've studied the diff of the project file, but I can't find anything obvious.
– Wukerplank
Nov 15 '18 at 22:58
How can we reproduce the issue? I tried this and the project without storyboard works.
– Willeke
Nov 16 '18 at 0:28
@Willeke Exactly as I described above: Create a brand new project, add a document type in the Info.plist and theapplication(application:open:)
callback to theAppDelegate
. But if it works for you right away, there must be something wrong with my setup...
– Wukerplank
Nov 16 '18 at 16:21
I use Xcode 9, maybe the templates of Xcode 10 are different. Are theCFBundleDocumentTypes
parts of Info.plist identical? Are theapplication(_:open:)
s identical?
– Willeke
Nov 16 '18 at 17:00
|
show 1 more comment
What I want to achieve is to drop files on the app's dock icon. It's well understood how to do it, no questions there. I tried to make it work with my existing project, but the icon does not get dimmed and the AppDelegate
would not get called.
So I created another project and it worked out of the box.
What my question boils down to: If I generate a new macOS project with Storyboards, this just works. If I generate a new project without checking the Storyboards box, it doesn't.
Is there something I miss? It's basically solved: I just generated a new project, moved all of the code and assets - done. But I'd like to understand the issue :-)
The Info.plist looks like this in both cases:
<?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>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleDocumentTypes</key>
<array>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>*</string>
</array>
<key>CFBundleTypeName</key>
<string>AllFiles</string>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
</dict>
</array>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIconFile</key>
<string></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>CFBundleVersion</key>
<string>1</string>
<key>LSMinimumSystemVersion</key>
<string>$(MACOSX_DEPLOYMENT_TARGET)</string>
<key>NSHumanReadableCopyright</key>
<string>Copyright © 2018 Wukerplank. All rights reserved.</string>
<key>NSMainStoryboardFile</key>
<string>Main</string>
<key>NSPrincipalClass</key>
<string>NSApplication</string>
</dict>
</plist>
The only difference of course is
<key>NSMainStoryboardFile</key>
<string>Main</string>
vs
<key>NSMainNibFile</key>
<string>MainMenu</string>
(Xcode 10.1, macOS Mojave)
xcode macos cocoa xcode10.1
What I want to achieve is to drop files on the app's dock icon. It's well understood how to do it, no questions there. I tried to make it work with my existing project, but the icon does not get dimmed and the AppDelegate
would not get called.
So I created another project and it worked out of the box.
What my question boils down to: If I generate a new macOS project with Storyboards, this just works. If I generate a new project without checking the Storyboards box, it doesn't.
Is there something I miss? It's basically solved: I just generated a new project, moved all of the code and assets - done. But I'd like to understand the issue :-)
The Info.plist looks like this in both cases:
<?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>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleDocumentTypes</key>
<array>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>*</string>
</array>
<key>CFBundleTypeName</key>
<string>AllFiles</string>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
</dict>
</array>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIconFile</key>
<string></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>CFBundleVersion</key>
<string>1</string>
<key>LSMinimumSystemVersion</key>
<string>$(MACOSX_DEPLOYMENT_TARGET)</string>
<key>NSHumanReadableCopyright</key>
<string>Copyright © 2018 Wukerplank. All rights reserved.</string>
<key>NSMainStoryboardFile</key>
<string>Main</string>
<key>NSPrincipalClass</key>
<string>NSApplication</string>
</dict>
</plist>
The only difference of course is
<key>NSMainStoryboardFile</key>
<string>Main</string>
vs
<key>NSMainNibFile</key>
<string>MainMenu</string>
(Xcode 10.1, macOS Mojave)
xcode macos cocoa xcode10.1
xcode macos cocoa xcode10.1
edited Nov 15 '18 at 22:01
Wukerplank
asked Nov 15 '18 at 21:55
WukerplankWukerplank
3,79222342
3,79222342
Is it because the storyboard architecture gives you a window controller?
– matt
Nov 15 '18 at 22:09
I still don't get it, @matt :-/ I moved all of my code, got rid of the storyboard, the whole project looks like the original one. The only difference is that dropping files on the app icon works now. I've studied the diff of the project file, but I can't find anything obvious.
– Wukerplank
Nov 15 '18 at 22:58
How can we reproduce the issue? I tried this and the project without storyboard works.
– Willeke
Nov 16 '18 at 0:28
@Willeke Exactly as I described above: Create a brand new project, add a document type in the Info.plist and theapplication(application:open:)
callback to theAppDelegate
. But if it works for you right away, there must be something wrong with my setup...
– Wukerplank
Nov 16 '18 at 16:21
I use Xcode 9, maybe the templates of Xcode 10 are different. Are theCFBundleDocumentTypes
parts of Info.plist identical? Are theapplication(_:open:)
s identical?
– Willeke
Nov 16 '18 at 17:00
|
show 1 more comment
Is it because the storyboard architecture gives you a window controller?
– matt
Nov 15 '18 at 22:09
I still don't get it, @matt :-/ I moved all of my code, got rid of the storyboard, the whole project looks like the original one. The only difference is that dropping files on the app icon works now. I've studied the diff of the project file, but I can't find anything obvious.
– Wukerplank
Nov 15 '18 at 22:58
How can we reproduce the issue? I tried this and the project without storyboard works.
– Willeke
Nov 16 '18 at 0:28
@Willeke Exactly as I described above: Create a brand new project, add a document type in the Info.plist and theapplication(application:open:)
callback to theAppDelegate
. But if it works for you right away, there must be something wrong with my setup...
– Wukerplank
Nov 16 '18 at 16:21
I use Xcode 9, maybe the templates of Xcode 10 are different. Are theCFBundleDocumentTypes
parts of Info.plist identical? Are theapplication(_:open:)
s identical?
– Willeke
Nov 16 '18 at 17:00
Is it because the storyboard architecture gives you a window controller?
– matt
Nov 15 '18 at 22:09
Is it because the storyboard architecture gives you a window controller?
– matt
Nov 15 '18 at 22:09
I still don't get it, @matt :-/ I moved all of my code, got rid of the storyboard, the whole project looks like the original one. The only difference is that dropping files on the app icon works now. I've studied the diff of the project file, but I can't find anything obvious.
– Wukerplank
Nov 15 '18 at 22:58
I still don't get it, @matt :-/ I moved all of my code, got rid of the storyboard, the whole project looks like the original one. The only difference is that dropping files on the app icon works now. I've studied the diff of the project file, but I can't find anything obvious.
– Wukerplank
Nov 15 '18 at 22:58
How can we reproduce the issue? I tried this and the project without storyboard works.
– Willeke
Nov 16 '18 at 0:28
How can we reproduce the issue? I tried this and the project without storyboard works.
– Willeke
Nov 16 '18 at 0:28
@Willeke Exactly as I described above: Create a brand new project, add a document type in the Info.plist and the
application(application:open:)
callback to the AppDelegate
. But if it works for you right away, there must be something wrong with my setup...– Wukerplank
Nov 16 '18 at 16:21
@Willeke Exactly as I described above: Create a brand new project, add a document type in the Info.plist and the
application(application:open:)
callback to the AppDelegate
. But if it works for you right away, there must be something wrong with my setup...– Wukerplank
Nov 16 '18 at 16:21
I use Xcode 9, maybe the templates of Xcode 10 are different. Are the
CFBundleDocumentTypes
parts of Info.plist identical? Are the application(_:open:)
s identical?– Willeke
Nov 16 '18 at 17:00
I use Xcode 9, maybe the templates of Xcode 10 are different. Are the
CFBundleDocumentTypes
parts of Info.plist identical? Are the application(_:open:)
s identical?– Willeke
Nov 16 '18 at 17:00
|
show 1 more comment
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53328440%2fmacos-dropping-a-file-on-the-dock-icon-project-with-and-without-storyboard%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53328440%2fmacos-dropping-a-file-on-the-dock-icon-project-with-and-without-storyboard%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Is it because the storyboard architecture gives you a window controller?
– matt
Nov 15 '18 at 22:09
I still don't get it, @matt :-/ I moved all of my code, got rid of the storyboard, the whole project looks like the original one. The only difference is that dropping files on the app icon works now. I've studied the diff of the project file, but I can't find anything obvious.
– Wukerplank
Nov 15 '18 at 22:58
How can we reproduce the issue? I tried this and the project without storyboard works.
– Willeke
Nov 16 '18 at 0:28
@Willeke Exactly as I described above: Create a brand new project, add a document type in the Info.plist and the
application(application:open:)
callback to theAppDelegate
. But if it works for you right away, there must be something wrong with my setup...– Wukerplank
Nov 16 '18 at 16:21
I use Xcode 9, maybe the templates of Xcode 10 are different. Are the
CFBundleDocumentTypes
parts of Info.plist identical? Are theapplication(_:open:)
s identical?– Willeke
Nov 16 '18 at 17:00