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/
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
Using Xcode 12.4 Simulator 14.4
For the alert displayed below, I have the following function in my XCUITests that I use to pull the static text displayed on the System Alert:
_ = addUIInterruptionMonitor(withDescription: "", handler: { (alert) -> Bool in
var data = alert.staticTexts.allElementsBoundByIndex.map {$0.label}
...
})
This worked when using Xcode 11.3 Sims 13.3; however, I just upgraded Xcode and now it crashes on when running the map function and gives the following error:
error: Execution was interrupted, reason: internal ObjC exception breakpoint(-8)..The process has been returned to the state before expression evaluation.
If I put a breakpoint, I can see the following:
po alert.staticTexts.allElementsBoundByIndex.count -> returns 3
po alert.staticTexts.allElementsBoundByIndex[0].label -> returns "Allow “X” to use your location?"
po alert.staticTexts.allElementsBoundByIndex[1].label -> returns "Your location is used to find and display nearby X facilities."
po alert.staticTexts.allElementsBoundByIndex[2] -> returns StaticText, {{32.0, 12.0}, {72.5, 16.0}}, label: 'Precise: On'
However, when I run the following (or runs during my test), it fails but as you can see from above, it does have a static text element at that position:
po alert.staticTexts.allElementsBoundByIndex[2].label -> No matches found for Element at index 2 from input {(
StaticText)} error: Execution was interrupted, reason: internal ObjC exception breakpoint(-8)
If I remain in the console and rerun the same call again, it then works though:
po alert.staticTexts.allElementsBoundByIndex[2].label -> "Precise: On"
Does anyone know what causes this error or a solution for how I can handle it in my test?
As this alert is "outside" your application and everything works when you debug/pause execution, I have to think this is something to do with synchronization.
Do you have anything waiting for the alert to fully display? I don't usually trust the UIInterruptionHandler to do more than auto-dismiss an alert not under test.
I'm using a page object model and typically wait for new pages in the initializer using something like _ = XCUIApplication().alerts.firstMatch.waitForExistence(timeout: 2.0)
That doesn't explain why your example of calling it twice in the console works, but timing is where I'd be looking. I feel that's the only time I ever see errors like this.
It could also be related to the map not being static or loading slowly and therefore changing the accessibility after XCUITest thinks it has finished loading and proceeds. Throwing in a nice long Thread.sleep would be the easiest way to debug that.
Got this strange error when running a unit test. It only appears when attaching to the process when testing the target by Xcode. Testing the target without attaching debugger works. Running the test by command line tool also works. Any idea about the reason? Thanks!
DetailsThe request to open "org.cocoapods.UnitTestHost" failed.
Domain: FBSOpenApplicationServiceErrorDomain
Code: 1
Failure Reason: The request was denied by service delegate (SBMainWorkspace) for reason: Unspecified ("null").
User Info: {
BSErrorCodeDescription = RequestDenied;
FBSOpenApplicationRequestID = 0x2594;
}
--
The operation couldn't be completed. (null)
Domain: FBSOpenApplicationErrorDomain
Code: 1
Failure Reason: (null)
User Info: {
BSErrorCodeDescription = Unspecified;
}
--
Some related error messages from the console:
SpringBoard (SpotlightUI) Reply Error on 0x600000857000:Connection interrupted
runningboardd (RunningBoard) failed to get pid for label UIKitApplication:org.cocoapods.UnitTestHost[6d75][rb-legacy] : No such process (3)
runningboardd (RunningBoard) Failed to start job for application<org.cocoapods.UnitTestHost>: <NSError: 0x7fa02351ca80; domain: NSPOSIXErrorDomain; code: 3; reason: "No such process"> {
userInfo = {
RBLaunchdOperation = launch_get_running_pid_4SB;
RBLaunchdJobLabel = UIKitApplication:org.cocoapods.UnitTestHost[6d75][rb-legacy];
}
}
runningboardd (RunningBoard) Launchd says label UIKitApplication:org.cocoapods.UnitTestHost[6d75][rb-legacy] has never exited
runningboardd (RunningBoard) Removing job: <RBLaunchdJob: 0x7fa02491a110; UIKitApplication:org.cocoapods.UnitTestHost[6d75][rb-legacy]>
Check your scheme settings and make sure all empty settings are unchecked. After doing this restart Xcode and simulator. Product menu > Scheme > Edit Scheme > Run > Arguments > Environment Variables
If there is a checkmark there with an empty field next to it, then uncheck it.
Try resetting your simulator
sudo rm -rf /private/tmp/com.apple.CoreSimulator.SimDevice.*
If it doesn't work try to restart the system.
Check Mach-O Type of your app.
Usually this error appears when you try to run Mach-Object with inappropriate type like Dynamic Library/Bundle/Static Library/Relocatable Object File. To solve the issue select Project -> Build Settings. Search Mach-O Type, change type to Executable.
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.