How to Set Up Gccontroller Valuechangehandler Properly in Xcode

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:

  1. Delete all your bridging files that you created until now.
  2. Select the main folder of project and hit new file->iOS->Header file.
  3. Write your imports in the header file created.
  4. 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



Leave a reply



Submit