fastlane-old / snapshot

Automate taking localized screenshots of your iOS app on every device
https://fastlane.tools
1.95k stars 140 forks source link

Issue with launch_arguments #480

Closed tache closed 8 years ago

tache commented 8 years ago

Using snapshot 1.11.0 I am either having a user issue with configuration, it does not work the way I think it should, or it is broke.

I have the following in my Snapfile:

launch_arguments([ "-adsDisabled YES" ])

In my Swift XCTestCase I have

...
    let app = XCUIApplication()

    override func setUp() {
        super.setUp()
        setupSnapshot(app)
        app.launch()
    }
...

In my view controller of the app target, I have

let FASTLANE_SNAPSHOT = NSUserDefaults.standardUserDefaults().boolForKey("FASTLANE_SNAPSHOT")
let ADS_DISABLED = NSUserDefaults.standardUserDefaults().boolForKey("adsDisabled")

when running snapshot --verbose, I do not see either as being set.

When I add the following in the view controller, and then check out the ~/Library/Logs/snapshot/<app>.log, I do not see either of the key/pairs set.

print(NSUserDefaults.standardUserDefaults().dictionaryRepresentation());
galli-leo commented 8 years ago

I have the exact same issue. Fresh install of snapshot.

galli-leo commented 8 years ago

I have found the problem. When generating a new UI Test Target Xcode creates the following line in setUp(): XCUIApplication().launch(). If you remove this it works!

tache commented 8 years ago

I commented out the app.launch() from Setup as shown in the above example, and I still do not see the settings.

vpolouchkine commented 8 years ago

Can you please post your full Snapfile and XCTestCase class? Thanks!

fastlane-bot commented 8 years ago

This issue was migrated to https://github.com/fastlane/fastlane/issues/1634. Please post all further comments there.

fastlane is now a mono repo, you can read more about the change in our blog post. All tools are now available in the fastlane main repo :rocket: