raycast / script-commands

Script Commands let you tailor Raycast to your needs. Think of them as little productivity boosts throughout your day.
https://raycast.com
MIT License
5.99k stars 887 forks source link

Swift script that imports AppKit cannot find NSWorkspace #930

Closed objectmethod closed 6 months ago

objectmethod commented 6 months ago

The following script:

#!/usr/bin/swift

// Required parameters:
// @raycast.schemaVersion 1
// @raycast.title directory
// @raycast.mode compact

// Optional parameters:
// @raycast.icon 🤖
// @raycast.argument1 { "type": "text", "placeholder": "Placeholder" }

// Documentation:
// @raycast.description Go to google
// @raycast.author objectmethod
// @raycast.authorURL https://raycast.com/objectmethod

import AppKit

if let url = URL(string: "https://www.google.com") {
    NSWorkspace.shared.open(url)
}

gives the following error

Reason: JIT session error: Symbols not found: [ _OBJC_CLASS_$_NSWorkspace ]
Failed to materialize symbols: { (main, { __swift_FORCE_LOAD_$_swiftMetal_$_directory, __swift_FORCE_LOAD_$_swiftXPC_$_directory, ___swift_instantiateConcreteTypeFromMangledName, _$s9directory17fallbackUrlStringSSvp, _$sSa12_endMutationyyF, __swift_FORCE_LOAD_$_swiftDispatch_$_directory, _$s10Foundation3URLVSgWOh, _symbolic _____Sg 10Foundation3URLV, __swift_FORCE_LOAD_$_swiftOSLog_$_directory, __swift_FORCE_LOAD_$_swiftIOKit_$_directory, __swift_FORCE_LOAD_$_swiftos_$_directory, _$ss26DefaultStringInterpolationVWOh, _$sSlsSQ7ElementRpzrlE5split9separator9maxSplits25omittingEmptySubsequencesSay11SubSequenceQzGAB_SiSbtFfA1_, __swift_FORCE_LOAD_$_swiftCoreImage_$_directory, _$s9directory13baseUrlStringSSvp, ___swift_instantiateConcreteTypeFromMangledNameAbstract, _symbolic SaySsG, __swift_FORCE_LOAD_$_swiftFoundation_$_directory, _$sSlsSQ7ElementRpzrlE5split9separator9maxSplits25omittingEmptySubsequencesSay11SubSequenceQzGAB_SiSbtFfA0_, _$sSaySsGSayxGSTsWl, __swift_FORCE_LOAD_$_swiftObjectiveC_$_directory, _$sS2sSysWl, __swift_FORCE_LOAD_$_swiftCoreFoundation_$_directory, _$s10Foundation3URLVSgMD, _$sSaySsGWOh, _$sS2SSlsWl, _$sSJWOh, _$ss27_finalizeUninitializedArrayySayxGABnlF, __swift_FORCE_LOAD_$_swiftUniformTypeIdentifiers_$_directory, _main, _$sSSWOh, __swift_FORCE_LOAD_$_swiftCoreGraphics_$_directory, __swift_FORCE_LOAD_$_swiftDarwin_$_directory, _got.$s10Foundation3URLVMn, $.directory.__inits.0, __swift_FORCE_LOAD_$_swiftQuartzCore_$_directory, _$ss5print_9separator10terminatoryypd_S2StFfA1_, _$sSaySsGSayxGSTsWL, _$sS2sSysWL, _$s9directory17formattedUsernameSSvp, _$s9directory8usernameSSvp, _$ss5print_9separator10terminatoryypd_S2StFfA0_, _$sS2SSlsWL, _$sSaySsGMD }) }
Domain: scripts
Time: 15:12:50.400
dehesa commented 6 months ago

I believe you are encountering this issue. Would you mind trying the solution described there and let me know?

objectmethod commented 6 months ago

Ah, thanks.