I was trying to show my nextKeyboardButton based on the value of needsInputModeSwitchKey when the viewDidLoad or viewWillAppear.
nextKeyboardButton.isHidden = !self.needsInputModeSwitchKey
However, my Xcode console always showed this error when I call the key at viewDidLoad, viewWillAppear, viewWillLayoutSubviews and viewDidLayoutSubviews.
2024-10-15 11:50:34.306515+0800 MyKeyboard[6040:25025964] [External] -[UIInputViewController needsInputModeSwitchKey] was called before a connection was established to the host application. This will produce an inaccurate result. Please make sure to call this after your primary view controller has been initialized.
The timing of connection was established to the host application. probably not related to the life cycle of extension? What's the right way use this key without warning?
Post
Replies
Boosts
Views
Activity
MacOS version: 13.6.4 (22G513) M1 Pro
Xcode version: 15.2(15C500b)
I was managed to build projects on iOS 15 device via network under same wifi connection.
However, I can not build any projects on iOS 17 devices via network, and the Connect via IP address option also not displayed by iOS 17 device in device list window.
I've submitted a issue feedback to Apple, is there any workaround of this issue?
Hello forum, I'm trying to build communications between a non-MFi HID device (say, a keyboard with a USB-C port) and an iOS device over a MFi-licensed cable with Swift, what framework would you suggest?
The USB-C cable is MFi-licensed.
The keyboard is not MFi-licensed.
Hello, forum, I'm trying to build connection between a non-MFi HID device (like keyboard) and iOS app with IOKit and Swift.
Thanks to this post, I have manage to import the IOKit into objc header.
IOKit on iOS/iPadOS 16.0+
#import <IOKit/IOKitLib.h>
However, I have this compiler error when I try to imitate same methods in the SerialPortSaple project from following article, but the IOKit can not be imported to Swift at first place.
Communicating with a Modem on a Serial Port
The screen shot of the sample project:
It looks like the complier unable to reach the io_object_t type somehow, is there any workaround or approach?
Our keyboard extension can be accessed independently in China region with native app like Notes or Safari, however the keyboard can only be opened in the app under same project in Taiwan region.
I've checked some articles about how MDM managing extensions, also make sure our RequestOpenAccess option of keyboard extension info.plist also set to Yes.
I'm not sure is there anything I missed, or I just need to inform client that they need to reach out their MDM manager and modify some restrictions?
If keyboard supports mobile device management (MDM), it can work with managed apps.
App extensions give third-party developers a way to provide functionality to other apps or even to key systems built into the operating systems
Allow full access to custom keyboard in iOS
My Xcode version is 14.3(14E222b), MacOS is 13.6.4 with M1 Pro chip, according to Xcode support page, the Xcode supports iOS simulator from 13.7 to 16.4.
However, there's no avaliable iOS version below iOS 16.4 can be selected, even it was installed.
The command line tolls is Xcode14.1, I've also tried to change to 14.3 and 15.2, but didn't work.
My app always crash when I trying to assign an enum to a value of[String: Any] only on iOS14.6, tested on iOS15, iOS16, iOS17, never saw this issue.
The function would pass an ConnectState enum and a serial number string to a userInfo of notification, received class may perform some UI updates when connect state changed.
func post(state: ConnectState, serial: Int) {
var userInfo: [String: Any] = [:]
userInfo["state"] = state
userInfo["serial"] = serial
print(userInfo)
NotificationCenter.default.post(name: NSNotification.Name("PostName"), object: nil, userInfo: userInfo)
}
@objc enum ConnectState: UInt8 {
case connected = 0x00
case disConnected = 0x01
var description: String {
switch self {
case .connected:
return "connected"
case .disConnected:
return "disConnected"
}
}
}
Classes received this notification, may perform some task based on connect state changed.
class AClass {
init() {
NotificationCenter.default.addObserver(self, selector: #selector(handleNotification(_:)), name: NSNotification.Name("PostName"), object: nil)
}
@objc func handleNotification(_ notification :Notification) {
let state = notification.userInfo?["state"] as! ConnectState
print("AClass handleNotification: \(state.description)")
}
}
let a = AClass()
post(state: .disConnected, serial: 123456)
post(state: .connected, serial: 123456)
//["serial": 123456, "state": __lldb_expr_3.ConnectState]
//AClass handleNotification: disConnected
//["serial": 123456, "state": __lldb_expr_3.ConnectState]
//AClass handleNotification: connected
The crashes always happened in the line that assigning the ConnectState enum to dictionary [String: Any] value, both connect state and serialNumber are not nil or optional.
I'm not sure why would this related to a allocate issue, is my code wrong?
AppName(645,0x16f61f000) malloc: can't allocate region
:*** mach_vm_map(size=1152921504606863360, flags: 100) failed (error code=3)
AppName(645,0x16f61f000) malloc: *** set a breakpoint in malloc_error_break to debug
```Since we only have one iOS14.6 device, it will be a challenge to test on other same iOS version device, nor test on simulator.
I'm working on a app that can communicate, send and receive data from our own MFi scanner.
Ideally, this app can receives data and remains communication even when it's in background, but I can only runs a background task for maximum 30 sec.
Along with this main app, we also have a keyboard extension as an interface that can publish collected data to other app that user prefers with string format.
However, It seems like Apple doesn't allow to implement UIApplication.shared.beginBackgroundTask method in extension class, is there any alternative that worth to try?
Also, can I extend app background task time elapsed to at least 30 minutes?
If I can get an official response would be great!
Environment: Xcode 14.3.0 and 15.2.0, macOS 13.6.4 (22G513)
Xcode would crash EVERY time with following steps:
Current activated working area is a storyboard editor.
Pressing option key and tap another view controller tab, this action should open the VC in the other side window
Xcode crash
Since I start to wrote UITest, this keep happened with no waring, following image
is the log, sensitive info has been replaced.
However, once I run app, then run test again, UITest just work out, it seems like a wired but, and the method just a working around bug to me,
I'm currently developing a custom keyboard which bundled with main app.
The keyboard would randomly crash when switch between apps with opened custom keyboard on physical device.
I've read posts around but seems not what I've encountered.
Bundle ID of main app: com.company.appName
Bundle ID of keyboard extension: com.company.appName.Keyboard
When custom keyboard is opened second time on other app, a sole personality warning would show up, but this won't lead to crash.
WARNING! Sole personality is ambiguous; this may lead to erratic behavior
[lifecycle] [u 9A2D7B1D-20AF-4E2A-A72F-C37C8D4FDEEA] [com.company.appName.Keyboard(1.0.0)] WARNING! Sole personality is ambiguous; this may lead to erratic behavior; personalities: {
"com.companyName.appName.keyboard" = {
19209 = "<PKServicePersonality: 0x28299da00; core = <[u 9A2D7B1D-20AF-4E2A-A72F-C37C8D4FDEEA] [com.company.appName.Keyboard(1.0.0)],[d (null)] [/private/var/containers/Bundle/Application/67892ACC-5BDA-4205-828D-4D94D6E87ABD/AppName.app/PlugIns/Keyboard.appex]>, host pid = 19209>";
19293 = "<PKServicePersonality: 0x28298fb00; core = <[u DA59190E-D8A2-4109-8D7B-1702E03AB0BD] [com.company.appName.Keyboard(1.0.0)],[d (null)] [/private/var/containers/Bundle/Application/67892ACC-5BDA-4205-828D-4D94D6E87ABD/AppName.app/PlugIns/Keyboard.appex]>, host pid = 19293>";
299 = "<PKServicePersonality: 0x282981700; core = <[u 61DC0533-3D02-4CE7-83C2-D698537BC6ED] [com.company.appName.Keyboard(1.0.0)],[d (null)] [/private/var/containers/Bundle/Application/67892ACC-5BDA-4205-828D-4D94D6E87ABD/AppName.app/PlugIns/Keyboard.appex]>, host pid = 299>";
};
}
After switching between apps for few times, the custom keyboard would crash,
common crash log is :
Connection to plugin invalidated while in use.
2023-12-13 10:19:44.220973+0800 MobileNotes[36435:1892265] [lifecycle] [u 9A37D3B6-CAE5-4E5C-95FF-DA653DC080E5:m (null)] [com.companyName.appName.Keyboard(1.0.0)] Connection to plugin interrupted while in use.
2023-12-13 10:19:44.221229+0800 MobileNotes[36435:1892265] [lifecycle] [u 9A37D3B6-CAE5-4E5C-95FF-DA653DC080E5:m (null)] [com.companyName.appName.Keyboard(1.0.0)] Connection to plugin invalidated while in use.
Another crash log is bit more detailed, but still not sure what it may refers to.
`
2023-12-13 10:19:44.222563+0800 MobileNotes[36435:1892256] [NSExtension] Unable to setup extension context - error: Couldn’t communicate with a helper application.
2023-12-13 10:19:44.222646+0800 MobileNotes[36435:1892256] [NSExtension] Async Begin using internal completion handler called multiple times. Due to error after initial completion: Error Domain=NSCocoaErrorDomain Code=4097 "connection to service named com.company.appName.Keyboard.apple-extension-service" UserInfo={NSDebugDescription=connection to service named com.company.appName.Keyboard-extension-service}
Program ended with exit code: 9`
I'm practicing a swift 5 class, and have this issue:
Could not launch “I AM RICH”
Domain: IDEDebugSessionErrorDomain
Code: 3
Failure Reason: The operation couldn’t be completed. Unable to launch com.superdie.I-AM-RICH because it has an invalid code signature, inadequate entitlements or its profile has not been explicitly trusted by the user.
User Info: {
DVTRadarComponentKey = 855031;
RawLLDBErrorMessage = "The operation couldn\U2019t be completed. Unable to launch com.superdie.I-AM-RICH because it has an invalid code signature, inadequate entitlements or its profile has not been explicitly trusted by the user.";
}
I'm not sure what can I do, some help would be nice :)