I'm porting working Swift code to Xamarin for my project. Every time I call this function, it fails and the accessory picker dialog doesn't show.
EAAccessoryManager.SharedAccessoryManager.ShowBluetoothAccessoryPicker(predicate, completion)
Here's some things I've confirmed:
BT Radio is on
Info.plist has Supported external accessory protocols
Tried ensuring call is done on UI thread
Tried calling directly from Button click event
The same basic code in Swift / Xcode works fine
Made sure that ARMv7 and ARM64 were selected in build options per this article: iPad Air - CoreBluetooth[ERROR] Cancelling picker as we couldn't communicate with Bluetooth
Xamarin:
EAAccessoryManager.SharedAccessoryManager.ShowBluetoothAccessoryPicker(null, completion: ((Foundation.NSError error) => {
Console.WriteLine("My callback");
if (error != null) {
Console.WriteLine(String.Format("Error code: {0} Desc: {1}", error.Code, error.DebugDescription));
Console.WriteLine("Failed? " + EABluetoothAccessoryPickerError.Failed.ToString());
Console.WriteLine("Failed? " + Convert.ToInt64(EABluetoothAccessoryPickerError.Failed));
}
}));
Xcode / Swift:
EAAccessoryManager.sharedAccessoryManager().showBluetoothAccessoryPickerWithNameFilter(nil) { (error) -> Void in
if error != nil {
NSLog("Error code: \(error!.code) \(error.debugDescription)")
}
}
The Xamarin code doesn't show the picker and will always fail.
2016-04-05 19:54:02.136 ASGDemo.iOS[6383:2146384] Connect Clicked
2016-04-05 19:54:06.139 ASGDemo.iOS[6383:2146384] BTM: attaching to BTServer
2016-04-05 19:54:09.157 ASGDemo.iOS[6383:2146384] BTM: session attach called back with BT_SESSION_ATTACHED (fffffed0)
2016-04-05 19:54:09.158 ASGDemo.iOS[6383:2146384] BTM: attemping to re-attach in 1 seconds
2016-04-05 19:54:09.242 ASGDemo.iOS[6383:2146384] My callback
2016-04-05 19:54:09.250 ASGDemo.iOS[6383:2146384] Error code: 3 Desc: Error Domain=EABluetoothAccessoryPickerErrorDomain Code=3 "(null)"
2016-04-05 19:54:09.253 ASGDemo.iOS[6383:2146384] Failed? Failed
2016-04-05 19:54:09.254 ASGDemo.iOS[6383:2146384] Failed? 3
The nice folks at Xamarin helped me directly, so I'm posting the solution here. They said it was a bug that has already been fixed. The update should ship later this month via automatic updates (if you have that enabled).
For now, they provided a workaround that I've verified to work for me and my co-workers on our project. Below are the steps of the workaround:
Clean the project
Uncheck the Enable device-specific builds in the project options under iOS-Build section.
Remove old app from the device
Now, rebuild / redeploy and it should work.
Thank you everyone for your suggestions and help. Also, thanks to the folks at Xamarin for their prompt response.
Related
Why am I getting this error message in the debug window when I go through the process of simulating expiration of a background task. I put a breakpoint at the line right after the call to submit, where the print statement that prints "submit succeeded" as you see below. I've looked at other posts at Apple Developer Forums and here on stackoverflow. I have tried probably all the answers. I still don't have a solution. When I used Apple's sample ColorFeed Xcode project, it worked the first time as I recall, and then it stopped working. It doesn't work in my project and also in a separate project I created just to test simulating the expiration of a task I submit.
Task with identifier <decode: missing data> is not currently being simulated
let request = BGProcessingTaskRequest(
identifier: BGTaskIdentifiers.processingTaskIdentifier)
request.earliestBeginDate = Date(timeIntervalSinceNow: 3)
do {
try BGTaskScheduler.shared.submit(request)
print("submit succeeded")
} catch {
print("submit failed with catch error:\n\t\(error.localizedDescription)")
}
Here's what the debug window shows:
e -l objc -- (void)[[BGTaskScheduler sharedScheduler] _simulateExpirationForTaskWithIdentifier:#"background.processing.task"]
2022-11-02 21:13:14.221109-0500 TrialBackgroundProcessingTask[13301:615495] Simulating expiration for task with identifier background.processing.task
2022-11-02 21:13:14.221675-0500 TrialBackgroundProcessingTask[13301:615495] Task with identifier <decode: missing data> is not currently being simulated
Are there any changes in FairPlay logic? My app has FairPlay protected Videos and Audio, they work perfectly until iOS 15.7, but in iOS 16
makeStreamingContentKeyRequestData is throwing me following error :
Error Domain=CoreMediaErrorDomain Code=-19152 "(null)"
Error Domain=AVFoundationErrorDomain Code=-11800 "The operation could not be completed"
UserInfo={NSLocalizedFailureReason=An unknown error occurred (-19156), NSLocalizedDescription=The operation could not be completed,
NSUnderlyingError=0x280deac10 {Error Domain=NSOSStatusErrorDomain Code=-19156 "(null)"}}
What could be the possible reason for this and solution?
Thanks in Advance
Function streamingContentKeyRequestDataForApp is deprecated on iOS 15 according to documentation. Use function makeStreamingContentKeyRequestData that is specified in new function documentation. Here is an example usage:
func makeStreamingContentKeyRequestData(
forApp appIdentifier: Data,
contentIdentifier: Data?,
options: [String : Any]? = nil,
completionHandler handler: #escaping (Data?, Error?) -> Void
)
We are using AVContentKeySession for downloading, met with the same error, and fixed it. For our case, the issue was as following.
Issue observed:
On iOS16.0.3, 12s later after "license request" was triggered firstly by app during downloading, "license request" would be triggered again by AVFoundation framework
("contentKeySession(_ session: AVContentKeySession, didProvide keyRequest: AVContentKeyRequest)" was called again), and then error “-19152“ wad reported quickly by framework.
Error log:
contentKeySession(_:contentKeyRequest:didFailWithError:), line: XXX,
message: XXX, url: XXX, error is Domain=CoreMediaErrorDomain
Code=-19152 "(null)"
On iOS15.6.1, after "license request" was triggered
by app during downloading, framework would not trigger any "license request" again.
Root cause:
iOS Framework API(AVContentKeySession & AVPersistableContentKeyRequest) behaviors changed on iOS16.
Solution:
Add “keyRequest.processContentKeyResponse(keyResponse)” after CKC has been downloaded on iOS16+.
On iOS11 - iOS15, we didn't call it after downloading, instead we only save persistentKeyData locally, and called processContentKeyResponse when playing. That always worked fine on these iOS versions.
But on iOS16 and above(until iOS16.1 Beta4 by now), the old process would trigger framework error. So we added this fix.
The issue I had was that the keyRequest.options was not getting set as it showed up nil (in iOS 16 for whatever weird reason).
I'm passing the correct options to
processContentKeyRequest(withIdentifer identifier: Any?, initializationData: Data?, options: [String : Any]? = nil).
But in the ContentKeyDelegate functions they are showing otherwise. So, my workaround is just using a global options dictionary for storing the license URL and asset data. You can use any storage method you prefer.
I have solved the issue, the issue was with duplicate EXT tags in m3u8 files which somehow worked for iOS 15 since it picked information from the first tag whereas in iOS 16 it was using all the tags and causing a Error
I am developing an application that uses both ARKit and hardware video decoder. As soon as the decoder start to decode, the following error message appears in console and prevent tracking from working properly.
Occasionally, this error do not show up and the app works normally. After some debugging, I found out this error only happens at the "beginning" (shortly after launching the app). Once it passes that point, it works fine for the rest of the time.
Does anyone know what the problem is or how to go around it?
2017-08-11 20:48:02.550228-0700 PortalMetal[4037:893878] [] <<<<
AVCaptureSession >>>> -[AVCaptureSession
_handleServerConnectionDiedNotification]: (0x1c0007eb0)(pthread:0x170387000) ServerConnectionDied 2017-08-11
20:48:02.564053-0700 PortalMetal[4037:893747] [Session] Session did
fail with error: Error Domain=com.apple.arkit.error Code=102 "Required
sensor failed." UserInfo={NSLocalizedFailureReason=A sensor failed to
deliver the required input., NSUnderlyingError=0x1c4c51280 {Error
Domain=AVFoundationErrorDomain Code=-11819 "Cannot Complete Action"
UserInfo={NSLocalizedDescription=Cannot Complete Action,
NSLocalizedRecoverySuggestion=Try again later.}},
NSLocalizedRecoverySuggestion=Make sure that the application has the
required privacy settings., NSLocalizedDescription=Required sensor
failed.}
Update
The solution is to do with compass calibration being set in the phone settings. Credit to this answer.
Go to Settings > Privacy > Location Services > System Services, and set Compass Calibration to ON.
How to prevent Crashing
Declare your config at the top of your class e.g:
var configuration = ARWorldTrackingConfiguration() and make sure you setup and add your config in the viewWillAppear method.
Then add this method to handle the error.
func session(_ session: ARSession, didFailWithError error: Error) {
// Present an error message to the user
print("Session failed. Changing worldAlignment property.")
print(error.localizedDescription)
if let arError = error as? ARError {
switch arError.errorCode {
case 102:
configuration.worldAlignment = .gravity
restartSessionWithoutDelete()
default:
restartSessionWithoutDelete()
}
}
}
It just handles the error that you've noticed.
Next, add this function to reset the session with a new config worldAlignment:
func restartSessionWithoutDelete() {
// Restart session with a different worldAlignment - prevents bug from crashing app
self.sceneView.session.pause()
self.sceneView.session.run(configuration, options: [
.resetTracking,
.removeExistingAnchors])
}
Hope it helps, and I also hope to find an actual fix to this apparent bug.
Setting worldAlignment to gravityAndHeading needs the location service to be enabled:
check if your device has location service turned on.
Check if Info.plist has set Privacy - Photo Library Additions Usage Description
If the compass orientation is crucial for your app, you should consider to guide the user to do turn the location service on and implement a fallback.
We have a hybrid application that doesn't show the remote disable message once we change the state from "Active" to "Access Disabled" even though the app is actually getting disabled as we can't use it anymore.
worklight.properties:
wl.remoteDisable.cache.enabled=true
wl.remoteDisable.cache.refreshIntervalInSeconds=1
initOption.js (I have added console.log to see what is the error in between):
onErrorRemoteDisableDenial : function (message, downloadLink) {
console.log("onErrorRemoteDisableDenial ......... Triggered");
WL.SimpleDialog.show(
appStoreUpdateTitle,
message,
[{text: notNowButton, handler: function() {WL.App.close();}},
{text: downloadNewVersionBtn, handler: function() {WL.App.openURL(downloadLink, "_blank");}}]
);
console.log("onErrorRemoteDisableDenial ......... Endded");
},
console.log (from xCode):
2017-03-28 10:51:57.312 GRSMobile[73598:5607189] onErrorRemoteDisableDenial ......... Triggered
2017-03-28 10:51:57.315 GRSMobile[73598:5607189] Warning: Attempt to present <UIAlertController: 0x7f9e29e2c000> on <CDVViewController: 0x7f9e29dd0290> whose view is not in the window hierarchy!
2017-03-28 10:51:57.315 GRSMobile[73598:5607189] onErrorRemoteDisableDenial ......... Endded
The same code works on Android but not iOS.
IBM MobileFirst Platform Version: 7.1.0.00.20161118-2214
This behavior seems similar to APAR PI74295, which is fixed in MobileFirst Platform Foundation 7.1 builds dated 20170109-1751 (and later). I suspect the cause is the same.
I would recommend to obtain a more recent iFix build and apply it, and use that to build your application and confirm if this issue is resolved.
Has anyone experienced and fixed:
XCTests are failing intermittently to launch app in the simulator for UI testing (XCUI).
I am running through fastlane, different tests appear to fail each test run.
OSX: 10.12.3
iOS simulator: 10.0
Xcode 8.2.1
Fastlane 2.11.0
Attempted to fix it by adding a 3 second sleep between setup and launch in my tests, but it still appears, maybe not as often but still...
UI Testing Failure - Failure attempting to launch
<XCUIApplicationImpl: 0x600000231b20 no.something.bb.debug at
/Users/server/Library/Developer/Xcode/DerivedData/ex-gmtcdujyggxwfrarizpgaromjfxj/Build/Products/Debug-iphonesimulator/BB.app>:
Error Domain=FBSOpenApplicationServiceErrorDomain Code=1 "The request
to open "no.something.bb.debug" failed."
UserInfo={NSLocalizedDescription=The request to open
"no.something.bb.debug" failed., NSLocalizedFailureReason=The request
was denied by service delegate (SBMainWorkspace) for reason: Busy
("Application "no.something.bb.debug" is installing or uninstalling,
and cannot be launched")., BSErrorCodeDescription=RequestDenied,
NSUnderlyingError=0x6080002598f0 {Error
Domain=FBSOpenApplicationErrorDomain Code=6 "Application
"no.something.bb.debug" is installing or uninstalling, and cannot be
launched." UserInfo={BSErrorCodeDescription=Busy,
NSLocalizedFailureReason=Application "no.something.bb.debug" is
installing or uninstalling, and cannot be launched.}}}
I experienced the same issue. I found out that there is a rader open for this. In the comments I found a tip that I implemented in a function that does a retry.
The arguments array is an array of enum values where the base type is String. I use that for the app arguments.
Unfortunately this is still not full prove. In my case the number of failures went down considerably, but did not go away.
var app: XCUIApplication = XCUIApplication()
public func tryLaunch<T>(_ arguments: [T], _ counter: Int = 10) where T: RawRepresentable {
sleep(3)
XCUIApplication().terminate()
sleep(3)
app = XCUIApplication()
app.launchArguments = arguments.map { $0.rawValue as! String }
app.launch()
sleep(3)
if !app.exists && counter > 0 {
tryLaunch(arguments, counter - 1)
}
}
The function above is included in https://github.com/evermeer/UITestHelper
After playing around we were observed that if we run limited test cases, this error went down considerably. You can find more details at https://blog.talentica.com/2017/04/04/use-xcode-8-with-jenkins/