Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to simulate iOS Background Fetch using Visual Studio 2015

I have searching for sometime but couldn't find how to simulate iOS Background Fetch using Visual Studio 2015. There seems to be a way to do it in XCode but I couldn't find anything for Visual Studio 2015.

Can any one help?

like image 502
U.P Avatar asked Oct 24 '25 14:10

U.P


1 Answers

Open the project options and goto the iOS Run Options. Under the Execution Mode, change it from Normal to Background Fetch.

enter image description here

Place a breakpoint within your PerformFetch override and start debugging the app, it will be launched with the mlaunch option of --launch-for-background-fetch

./mlaunch --help
    ~~~
    --launch-for-background-fetch
         Launch due to a background fetch
    ~~~

Note: There are some issues that I know about

🍣 Remote Simulator to Windows: This does not work all(?)/most the time(?). Disable it for your background fetch debugging as your app on the remote simulator does not need screen/touch interactions as it is running in a simulated background mode.

🍣 Some VS versions produce Error HE0042 in the error listing/log when using background fetch mode.

error HE0042: Could not launch the app 'com.companyname.App4' on the device 'iOS 11.1 (15B87) - iPhone 8': The request to open "com.companyname.App4" failed.

Those versions are just plain broke and you will need to use VS4M to test/debug your background fetch.

🍣 If you are using a custom Xcode location you will get a failure since they do not place spaces between the options.

enter image description here

So, instead of using the drop-down to set Background Fetch, use the cmd-line option directly in the mlaunch args _--launch-for-background-fetch_ adding a space before and after the option

like image 129
SushiHangover Avatar answered Oct 26 '25 10:10

SushiHangover



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!