Je suis en train de créer une bibliothèque AppleScript script, et je veux appeler certaines méthodes Cocoa sur NSString. J'ai créé un fichier .SCPTD avec cette méthode :
on xtrim(sourceText)
set the sourceString to current application's NSString's stringWithString:sourceText
set whitespace to {space, tab, return, linefeed}
set the adjustedString to sourceString's stringByTrimmingCharactersInSet(whitespace)
return (adjustedString as string)
end xtrim
Cependant, je reçois l'erreur NSString doesn’t understand the “stringWithString_” message.
. La plupart des réponses que je trouve sur Internet suggèrent que la case AppleScript/Objective-C Library n'est pas cochée.
Cependant, cette case à cocher a été supprimé avec la version Yosemite .
Quel est le problème avec le script ; existe-t-il un correctif ?