Detecting a physical keyboard from a keyboard extension swift ipadOS
You can detect physical keyboard on iOS 14 GameController SDK by using public API GCKeyboard. You just need to import GameController
let isKeyboardConnected = GCKeyboard.coalesced != nil
[GCController controllers] does not contain any controllers that were connected prior to application launch
After a huge amount of time searching, I found the answer on my own. It turns out that my code wasn't the problem -- the problem was that my Info.plist
file was having its CFBundleIdentifier
value stripped out due to a problem with my build system. It appears that the Game Controller Framework needs the bundle identifier to correctly populate [GCController controllers]
at launch. While a missing CFBundleIdentifier
would have been a problem anyway, as a Windows person it didn't occur to me that the identifier might be used for things besides the App Store, so I let it slide until now.
If someone else has this problem, make sure that CFBundleIdentifier
isn't missing or empty in Info.plist
in your assembled app bundle. In my case with Premake, I had to manually set PRODUCT_BUNDLE_IDENTIFIER
with xcodebuildsettings
so that $(PRODUCT_BUNDLE_IDENTIFIER)
would get properly replaced in Info.plist
.
Swift Bridging Header import issue
Be careful to add the file to the folder that your error is complaining!
I've made the same mistake, if you create the file from Xcode, it will go to the folder: Project->Project->Header.h
And Xcode is looking for Project->Header.h
That means you need to put the file inside your project folder (ProjectName->ProjectNameFolder)!
UPDATED:
I'm not sure if I got what you mean, but try this to solve your problem:
- Delete all your bridging files that you created until now.
- Select the main folder of project and hit new file->iOS->Header file.
- Write your imports in the header file created.
- Select the project inside Xcode->Build Settings, type in search field: bridging and put in the key SWIFT_OBJC_BRIDGING_HEADER the name of your header file or the path to it!
If you follow this steps, your header file will be created at the correct location!
Pop back to previous ViewController not working on Alert Error Message
Do like this,
let alert = UIAlertController (title: "Error message", message: errorMessage, preferredStyle: .alert)
alert.addAction(UIAlertAction(title: "OK", style: .cancel, handler:{ (alertOKAction) in
self.popThisView()
}))
self.present(alert, animated: true, completion: nil)
SVProgressHUD.dismiss()
Related Topics
How to Download a PDF File in Swift and Find in File Manager
Swift 2 Unused Constant Warning
How to Send Different Users to Separate View Controllers Using Firebase and Xcode
How to Rotate an Uiimageview Using Touchesmoved
App Crashes When User Starts Typing in Uisearchbar
Xcode 6 & Swift: Black Bars Appear Above and Below the Viewcontroller on iOS 7 iPhone 5 Device
Cocoapods, Add Dependencies to All Targets in a Generic Way
It Is Possible to Know If a String Is Encoded in Base64
Resize Inputaccessoryview Dynamically in iOS 8
Swiftui Multiple Navigationlinks in Form/Sheet - Entry Stays Highlighted
How to Read Heart Rate from iOS Healthkit App Using Swift