i want to make a phone call from Apple Watch too. I imported WatchKit. Then i put this code in my method:
if let telURL=NSURL(string:"tel:5553478") {
let wkExtension=WKExtension.sharedExtension()
wkExtension.openSystemURL(telURL)
}
It shows me an error: Use of unresolved identifier 'WKExtension' in line 2. I don't know what I am doing wrong :/
WKExtension is only available on WatchOS 2.0, as you can see from Apple's prerelease reference. So I'm guessing you're either not using Xcode 7 or you're working on a v1.0 watch extension.
Create a new target and choose watch OS > Application.
Related
Our app supports iOS 12 and up, however we have two new local frameworks "Jello" and "Wizdom" within the app, but they only support iOS 13 and later (so they can use Combine and SwiftUI).
The app weakly links against Jello, Wizdom, Combine, and SwiftUI. The app's main BaseUI module is what actually imports Jello. BaseUI supports iOS 12 and up so it also weakly links against Jello etc.
However we're running into a problem where BaseUI won't compile because of the error: Compiling for iOS 12.0, but module 'Jello' has a minimum deployment target of iOS 13.0.
How can I make the import conditional on iOS 13 being available (i.e. don't import it if iOS 13 is not available)?
(So far the only workaround I've found is to create an Objective C wrapper around Jello and access it through that wrapper, but this is awkward and kludgy. I also tried wrapping that whole file with #if canImport(SwiftUI) ... #endif however this also doesn't work because it seems that this is just a compile-time check.)
Have you try to conditionally import the framework as explained in this post : Conditionally import a framework (such as Speech) based on iOS Version in Swift??
There is a full explanation here
However, the main information is that you can define in the framework as optional under the “Targets” section -> "Build Phases" -> "Link Binary With Libraries" -> "Status" of the framework not available on iOS 12.
You also have to wrap the code using this library with the #available tag.
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
In Xcode 10, the "Copy Swift standard libraries" script is done last — after any custom build phases that may be added to the target. Hence it is not possible to create a custom build script to specifically remove Swift standard dylib files added by Xcode.
The question is, how to remove some of these standard libraries that are erroneously added by Xcode?
The reason behind it is that when Xcode 10 builds a Swift 4.2 macOS app that has a Photo Editing extension, it adds libswiftMapKit.dylib into the application bundle — even when the application does not have Maps functionality or import MapKit. This caused an App Review rejection.
To remove a Swift Standard Library, add a Post-Actions in the scheme. Most likely this would be an Archive post-action since archiving is typical prior to a release (upload to App Store or to re-sign using a Developer ID credential).
In Xcode 10 Click Edit Scheme.
In the scheme editing, expand the Archive section.
Click on Post-Actions
Enter the following bash script fragment (along with any other post-actions that you may already have)
# This variable points to the `Frameworks` folder of the final application.
full_frameworks_path="${ARCHIVE_PRODUCTS_PATH}/Applications/${FRAMEWORKS_FOLDER_PATH}"
# Specify the libraries to remove, the example below removes Swift's MapKit wrapper.
rm -f "${full_frameworks_path}/libswiftMapKit.dylib
However note that this does not solve the underlying problem of the Photos App Extension actually links to libswiftMapKit.dylib — a dependency added by Xcode 10.0 regardless whether it really uses MapKit or not.
I did import UIKit, but apparently Xcode is still not able to find UIAccessibility as mentioned in this WWDC. Also my os is above 3.0 as required for this.
The problem is you're not using Xcode 10 beta with Swift 4.2. So you can't say it that way. You have to call this method:
https://developer.apple.com/documentation/uikit/uiaccessibility/1615194-post?changes=latest_minor
As you can see, it used to be a global function UIAccessibilityPostNotification() taking two parameters.
i was working with the cocos 2d engine which i integrated in the xcode version 3.2.2.I started with the downloaded application which gave the error as 'GL_MAX_SAMPLES_APPLE' undeclared , later i tried with the blank project ,its still giving the same error.
I dont know whats wrong and where. please suggest me how to integrate cocos2d in xcode 3 and what all settings to do
thanks in advance..
In the Cocos2D v1.0 Release Notes you'll see that the minimum requirement is Xcode 3.2.6 with iOS 4.1. You said you're using Xcode 3.2.2. There's your problem, probably.
If you still want to use Xcode 3 then you can get the latest version 3.2.6 here. Personally I recommend to upgrade to Xcode 4.x for the simple reason that you can't create iOS 5 apps with Xcode 3 and Xcode 3 being incompatible with Mac OS X 10.7 Lion.
May be the file related to that is missing.
That definitely looks like a compile-type error, one generally caused simply by not having that symbol defined at the point where you want to use it.
Any number of things could be going wrong here. Here's a couple of things to check.
Are you including the correct header file (glext.h, I believe) in your sample?
Is that header file being picked up from the correct location (you may have other similarly named files in other places)?
Does that (or any other header file) even have that symbol defined?
If they do, do you have the correct defines so that you can see them (ofthen #define statements are themselves inside #ifdef ones)?