izik461
izik461

Reputation: 1173

Check if external app opened. UI testing xcode

In my app I am opening spotify using:

let kSpotifyAppLink = "spotify:app:mymusicapp"
var url = NSURL(string: kSpotifyAppLink)

if UIApplication.sharedApplication().canOpenURL(url!) {
   UIApplication.sharedApplication().openURL(url!)
}

Is it possible to check in UI tests if the spotify actually opened after button click?

Upvotes: 1

Views: 1252

Answers (1)

Oletha
Oletha

Reputation: 7639

It's not possible to detect whether other apps are open since XCTest only has a connection to your app, not Spotify's. For security reasons, iOS doesn't allow your app to know which app is in the foreground, only that your app needs to transition away from being in the foreground.

Upvotes: 4

Related Questions