Module 'AppleScriptKit' is incompatible with feature 'swift' - swift

I build an iTunes / Spotify controller that sits in the MacOS menu bar a year ago.
It's called MenuBar for those interested.
I recently upgraded MacOS to Mojave, which of course broke the application I had painstakingly written.
Since there is no match for my app on the mac :), I tried to digg back into the code to see if I could fix things and I get the following error :
Module 'AppleScriptKit' is incompatible with feature 'swift'
The file that is actually triggering the Swift Compiler Error during the build is the module.modulemap of AppleScriptKit framework (which I import at the beginning of my AppDelegate.swift file). The content of the file is below :
framework module AppleScriptKit [extern_c] {
requires !swift
module ASKPluginObject {
export *
header "ASKPluginObject.h"
}
}
The last time I successfully compiled was with High Sierra and I'm guessing XCode 9.something.
Now I'm using XCode 10.0.
I've tried to remove and add again the blasted framework.
I've tried to remove it from my app and the part of the app that doesn't use AppleScript works fine (but then it's pretty useless).
Does anyone see a solution ?
Have Apple really removed compatibility of swift with AppleScript ? If yes, what are the recommended alternatives ?
Thanks for your feedback

Related

Xcode 6 beta 3 doesn't recognize things defined in the Cocoa module swift

Xcode just stopped recognizing types defined in the cocoa module in swift even though i used
import Cocoa
The app still compiles though, basically the "Use of unresolved identifier"s just go away until after the build succeeds. The problem is that I cant debug my code when there are tons of errors showing up that aren't really there. I tried linking with Cocoa.framework, but like I thought it wouldn't make a difference when using swift.
Do you know a workaround to prevent this?
Just to let you know i have tried reinstalling Xcode, cleaning the build folder, adding a bridging header, making a new project, and importing AppKit directly like this.
import AppKit
this just makes source kit stop working
Also it imports Cocoa just fine when in a playground.
Betas will be beta. Try pressing Command+Option+Shift+K to clean the build folder and clear out Xcode's caches. If you can reproduce this issue with a consistent base case, then consider filing a Radar to report this bug.
I don't know why this happened but after installing xcode 6 beta 4 I haven't noticed the problem.
I was facing this issue as I changed the platform "from the right side menu" to mac os instead of iOS.
Hope this could help.

Lexical or Preprocessor Issue with Accounts framework

I recently installed the latest Facebook iOS SDK and included the Accounts framework for use with it. While I don't think the issue is related to the Facebook iOS SDK, I thought I'd mention it.
The error I'm getting when I compile now is this:
Pasting formed '_MAC#', an invalid preprocessing token
There are 3 of these errors, all within the Accounts framework header files that I cannot edit.
I'm using the default compiler: Apple LLVM compiler 4.2 with XCode version 4.6.3
I tried researching this issue for hours to no avail.
UPDATE: I tried compiling with Apple LLVM compiler 5.0 in XCode 5 Beta and I get even more compiler errors related to the Accounts framework.
UPDATE: I started a totally new project and rebuilt it from scratch. The same issue persists. As of now, it seems like my only option is to not use the new Facebook SDK or Accounts framework. I'm surprised no one else has this issue.
Have you set the Accounts.framework as "optional" under target settings?
Make it "Optional" and then Clean, Build and Run Project.
Solved it. I had a #define that looked like this in the pch file:
#define NA #"-"
Note to self. Do not use short define names in global header files.

UIGraphicsBeginImageContextWithOptions not compiling with 4.3 SDK (fine with 4.2 SDK)

I've been compiling and using the following code since iOS 4.0:
if(UIGraphicsBeginImageContextWithOptions != NULL)
{
UIGraphicsBeginImageContextWithOptions(drawCopyFS.frame.size, NO, 0.0);
}
else
{
UIGraphicsBeginImageContext(drawCopyFS.frame.size);
}
As soon as I switched to 4.3 SDK, this particular piece of code stopped compiling with the following two errors:
'UIGraphicsBeginImageContextWithOptions' undeclared (error on line #1)
Implicit declaration of function 'UIGraphicsBeginImageContextWithOptions' (error on line #7)
Anyone have any ideas why this is happening? Is something changed in 4.3, or how can I fix this?
Xcode doesn't color UIGraphicsBeginImageContextWithOptions the same way as it does UIGraphicsBeginImageContext and at the same time it doesn't provide any quick help for it.
First make sure the Base SDK is set to use the latest in the Project Info. If that doesn't work then read on.
I had a similar problem with UIBackgroundTaskIdentifier which was introduced in 4.0 and compiled fine before the SDK update. It turned out that Xcode was attempting to use headers from the iOS 3.2 SDK. The console output of the build process showed the old headers search path was passed into the compiler even though the Base SDK was most definitely set to the lastest in the Project Info.
Reloading the project didn't help. Restarting Xcode had no effect. There are reports that manually editing the project file has been necessary with past updates. However, when I opened the project file in a text editor I found the SDKROOT variables were correctly set to the latest SDK path.
What worked in my case was closing Xcode, restoring the 'MyProject.xcodeproj/project.pbxproj' file from source control to a point just prior to updating the SDK, then restarting Xcode and opening the project.
I was having the same problem with that symbol and also a bunch of other symbols, selectors and macros. As with the other responder, cleaning everything and removing pre-compiled headers didn't fix it. Nor did changing the SDK. What did fix it is switching from a simulator build to a device build, and then switching back.

Will old source code run with SDK 4.2?

I've been working on creating my own iPhone app with source code my company gave me. This code was created with iPhone SDK 3.0. I've worked on it for over a year (I'm a designer so my coding is mostly copy and paste) and to test the app on my iPhone it says I must update my SDK to 4.2. I'm wondering will this break my app? I probably don't have the skills in xcode to upgrade my code if I am required to rewrite parts.
Thanks,
Chris
If none of the code has been deprecated, changed or even removed, chances are good it still runs fine. Most projects run, and if you have used external code (and hopefully noted where you got it from) there might be an update available for that piece of code.
Just set the deployment target to iOS 3.0 in your project settings
here some little explanation: link

iphone sdk 3.2 to 4.0 nib editing

So I am working on an app that was compiled on sdk 3.2 and 2.2.1, but I have sdk 4.0. When I compile it, I get many build errors "Pattern colors not supported by the iphone SDK for iphone OS versions prior to 3.0" and "setText is deprecated."
Furthermore, when I open a nib file and try to change the colors, add in an item from the library, or mess around with it my changes and additions don't show up during runtime. I am thinking this is an issue with the interface builder, particularly the different SDK versions.
Is this the case? I am programming for the ipad, so I need at least 3.2?
Open the .xib file in Interface Builder, then select Window > Document Info, select a later version of Deployment Target OS version.
Your errors of "setText is deprecated" is an error in your code because apple updated their framework. The easiest to fix that would be to check the framework for a comment that says what to use.
When you make a change to a nib file, interface builder and Xcode require that you save before building the project.
The iPad is only 3.2, so yes you will need to build it for iOS 3.2.
Sorry I am OP, had to create an account since I was using a temp one.
Thanks for the answer, however, I'm not too worried about setText is deprecated because it builds successfully.
Regarding the nib file, I did save, clean and rebuild the project. I'm working on someone else's code done in earilier sdk's, and when I delete their objects in IB the app will still run fine, as though the interface builder is not responding. I add objects in the nib and they won't show up. If I do this is projects I create, it goes through finely. My guess is it's the different sdks?