xcode 8 beta - Error compiling to the real iOS device - ios

I couldn't find any related topic so I am starting the new one.
I have macOS Sierra and latest xcode 8.
When I attach my iPhone to macbook and try to build even clean project in xcode I get following swift compiler errors:
Attempting to use the forward class 'UIViewController' as superclass of 'UIActivityViewController'
Attempting to use the forward class 'UIViewController' as superclass of 'UIAlertController'
And so on. Error count is 21 and is always same no matter what project I choose.
Someone have same problem? Any solution?
Thanks for any answer.

Related

Xcode 14 beta: How to fix errors in Widget Custom Intents?

I opened the "Emoji Rangers App Xcode project created by Apple [click to download]" for the demo of WidgetKit and wanted to follow up with WWDC22 video.
However, while it worked fine in Xcode 12, when I opened this project in Xcode 13 beta, I got errors like this:
Method 'provideHeroOptionsCollection(for:)' with Objective-C selector 'provideHeroOptionsCollectionForDynamicCharacterSelection:withCompletion:' conflicts with method 'provideHeroOptionsCollection(for:with:)' with the same Objective-C selector; this is an error in Swift 6
Method 'confirm(intent:)' with Objective-C selector 'confirmDynamicCharacterSelection:completion:' conflicts with method 'confirm(intent:completion:)' with the same Objective-C selector; this is an error in Swift 6
Method 'handle(intent:)' with Objective-C selector 'handleDynamicCharacterSelection:completion:' conflicts with method 'handle(intent:completion:)' with the same Objective-C selector; this is an error in Swift 6
Please help me - how can I fix it?
BTW it's in the DynamicCharacterSelectionIntent.swift file, which says:
// This file was automatically generated and should not be edited.
You can use the Adding widgets to the Lock Screen and watch faces example project which extends the project you want.
However, while it worked fine in Xcode 12, when I opened this project in Xcode 13 beta, I got errors like this
You'll need Xcode 14 beta to run it. I don't really understand why would you use Xcode 13 beta these days – it was released a year ago.

Swift warning in Xcode 14 : Method confirm(intent:) conflicts with method confirm(intent:completion:) with the same Objective-C selector

Testing the new widget for iOS 16 with Xcode 14, I'm facing an issue trying to port the iOS 14 widget with the new WidgetFamily like .accessoryInline or .accessoryRectangular.
After adding conditional macros to solve some errors in order to build for watchOS and iOS (cf Apple WWDC 22 video: https://developer.apple.com/videos/play/wwdc2022/10050/), Xcode display no red errors but yellow blocking warnings:
Method 'confirm(intent:)' with Objective-C selector
'confirmConfiguration:completion:' conflicts with method
'confirm(intent:completion:)' with the same Objective-C selector; this
is an error in Swift 6
Any idea how to solve it?
EDITED : Finally works without fix that, see answer below. But I'm still interesting to remove this warning.
Finally, it passed without fixing this warning. I remove the last errors around the extension bundle name (has to be prefixed with the watch app bundle and follow by ".xxxxxx" of your choice without any further dot). I also had a "4" (Apple Watch) value to "Targeted Device Families" in build settings (was previously "1,2" for iPhone, iPad).

iOS 13 - FileManager url(forPublishingUbiquitousItemAt:expiration:) not working anymore

I've developed an iOS app that uses the url(forPublishingUbiquitousItemAt:expiration:) method of Apple's FileManager class. Starting with the first Beta of iOS 13 this function stopped working and now it throws an error, stating "This code has been removed. You should switch off of this SPI". But I can't find anything related to this function neither in the release notes of iOS nor in the documentation for this function, and it even states there that it would be supported on Mac Catalyst 13.0+.
This also has nothing to do with Xcode 10 and 11, as it occurs when the app is built using either one of those versions.
Does anyone of you know more about that? It would be great to get new information on that.
Thanks,
Fabian.
This is fixed in iOS 13 beta 6. Updated today and this error magically disappeared!
Had my mind blown when I saw this error message.

Xcode error: Semantic Issue, Property 'className' not found on object type 'GKEntity *'

Recently I started getting this error from Xcode:
Error Screenshot
This 'className' property belongs to NSObject. Here is the official documentation.
Why is this happening and how do I solve this (without avoiding using this property)?
The strange thing is that the exact same code worked just fine a few days ago on both the macOS AND the iOS target. Then it started showing this error AFTER the build successfully completed (i could run the project just fine), but now the iOS target won't even build...
I tried (1) purging my derivedData folder many times, (4) doing clean checkouts, (3) restarting Xcode, and (2) restarting the system, all of that in the correct order, but no success...
I'm using Xcode Version 8.2.1 on macOS 10.12.3 and my deployment targets are 10.2 for iOS and 10.12 for macOS.
I can't find any explanation of why this property has been removed, but it does appear to be!
I did find a solution, Get class name of object as string in Swift
String(describing: type(of: self))
As pointed out by #JamesP in a comment above the className property is clearly documented to exist only on macOS 10.0+, and not on iOS, which i failed to notice...
This means that my problem came from the fact that i changed my implementation's target settings from macOS only to macOS and iOS during development.
Because i'm using Objective-C i ended up replacing entity.className with
NSStringFromClass([entity class])
The answer from #Russel shows how to solve this in Swift.
A neat little extension should do the trick.
public extension NSObject {
var nameOfClass: String {
String(describing: type(of: self))
}
}

Xcode 6.2 - Expected type after 'as'

First time seeing this error, can't i put '!' after 'as' in swift?
Or just bug after updating my Xcode to 6.2?
let url = notification.userInfo![CallbackNotification.optionsURLKey] as! NSURL
It shows error :
Expected type after 'as'
P.S: You can try download OAuthSwift from github to test this error.
https://github.com/dongri/OAuthSwift
The as! notation was not introduced until Xcode 6.3. You have Xcode 6.2, so you have to say simple as. Xcode 6.2 does not understand your as!; that is the cause of the compiler error you are getting.
(Note that if you take those ! away, then when you eventually switch to Xcode 6.3 you have will have to bring them all back again! It really is best not to change Xcode versions backwards and forwards like this. If your code was written originally with Xcode 6.3, you should stay with Xcode 6.3. The only problem is that in that case you cannot submit an app to the App Store until it goes final; right now it is still in beta.)
You don't have to add ! to as to unwrap your optional variable in XCode 6.2

Resources