Use of unresolved identifier 'UIAccessibility' - swift

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.

Related

How to import a particular framework only if iOS 13 is available?

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.

AVCapturePhotoOutput - changes in Xcode 9 Beta 5

Just installed the latest XCode version which provided some changes in AVCapturePhotoOutput class, I wonder how to fetch the list of support flash modes. In the previous version, I used supportedFlashModes property which is no more available
open var __supportedFlashModes: [NSNumber] { get }
I guess new Swiftified supportedFlashModes property is planned but not yet completed in beta 5.
open var supportedFlashModes: [AVCaptureDevice.FlashMode] { get }
Until the day my guess will be confirmed (can be negative), you can use __supportedFlashModes. It's not removed, just renamed.
(Some betas contain this sort of under-construction renaming.)
You should better send a bug report to keep Apple aware of this issue.
EDIT
Seems iOS 11 SDK/Xcode 9.1 has fixed this issue and the Release Notes of Xcode 9.1 beta say:
The following AVFoundation API are now available:
AVCaptureDevice.Format.supportedColorSpaces
AVCaptureDevice.supportedFlashModes
AVCapturePhotoOutput.availablePhotoPixelFormatTypes
AVCapturePhotoOutput.availableRawPhotoPixelFormatTypes
AVCapturePhotoSettings.availablePreviewPhotoPixelFormatTypes
Code which was previously modified to use a double underscore as a
workaround should be modified to use these public symbols or the app
may be rejected by the App Store.
(Bold style added.)
Apple camera dev team confirms the Swift version of the API was inadvertently left out of Xcode 9 release.
Until fixed have to use __supportedFlashModes
See here: https://forums.developer.apple.com/thread/86810
BTW some other AVFoundation APIs also affected.

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.

Getting the error 'GL_MAX_SAMPLES_APPLE' undeclared (first use in this function) while working with cocos 2d engine

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)?

Permanently ignoring warnings

I have a project that compiles with some warnings. It's an iPhone project that uses some methods on NSDate, that are seemingly not the headers of the iPhone SDK, but work flawlessly none the less. When I call these methods I get warnings like:
NSDate warnings http://beautifulpixel.com/assets/NSDate_Warnings-20090215-235727.png
So how do I silence the warnings permanently, in order to tell XCode "it's OK, really."
Or how do I correct the warnings? This code works great on the device and Apple has already approved an app that uses these same methods, so surely I can get XCode to understand that the methods really are there.
I would very strongly advise you to not use these methods. Just because they are declared in Mac OS X's Foundation framework, does not stop them being private API on the iPhone. Apple would be well within their rights to discontinue your app from the store. Likewise, there's nothing to stop Apple tidying up Foundation a bit for an iPhone OS 2.2.2 or later release and removing those two methods, thereby breaking your app.
You can write a short interface extension early in you .m file to suppress these warnings
Example:
#interface NSDate (SuppressSomWarnings)
- (void)dateWithNaturalLanguageString:(NSString*)_str;
#end
It's strange, I do not get any warning when I type the same two lines... Did you correctly import the headers and frameworks into your project?
I see that they are defined in NSCalendateDate.h, which is in Foundation.framework.
Failing that, you can try and include the interface definitions directly into your code, e.g., at the top of your .m file, to see if that gets rid of the warnings. (See epatel's answer that came while I was writing this!)
Do you have the correct SDK configured?
You might be liking against the newest version, but using old header files.
Your code may work in the simulator but does it work on the phone?
The simulator uses the OS X Foundation framework which is a superset of what is available on the iPhone.