"Simulate Background Fetch" option grayed out in XCode
See original GitHub issueYour Environment
- Plugin version: 2.5.1
- Platform: iOS
- OS version: 11.4
- Xcode version: 9.4
- Device manufacturer / model: iPhone 8 Plus Simulator (but happens on others Iβve tested too)
- React Native version (
react-native -v
): 0.57.1 - Plugin config:
minimumFetchInterval: 60 * 24
Expected Behavior
After following tutorial to setup the Plugin using CocoaPods (https://github.com/transistorsoft/react-native-background-fetch/blob/master/docs/INSTALL-COCOAPODS-IOS.md), we should be able to test our deployment using the Xcode Menu option Debug -> Simulate Background Fetch
.
Actual Behavior
The option Debug -> Simulate Background Fetch
is grayed out and impossible to use to test our deployment.
As you can see in the logs below, BackgroundFetch is activated successfully. The problem is just the grayed out option to Simulate on Xcode.
Steps to Reproduce
Not sure, as I have just followed the tutorial.
Context
For now, just trying to log when a Fetch occurs, as following code:
BackgroundFetch.configure(
{
enableHeadless: true,
minimumFetchInterval: 60 * 24,
startOnBoot: true,
stopOnTerminate: false,
},
async () => {
console.log('just fetched stuff');
BackgroundFetch.finish(BackgroundFetch.FETCH_RESULT_NEW_DATA);
},
error => {
global.rollbar.error(error.message, { error, userId });
},
);
};
This function is called as a callback on a successful BackgroundGeolocation.start()
.
Debug logs
2019-04-01 16:53:54.417 [info][tid:main][RCTRootView.m:293] Running application pier ({
initialProps = {
};
rootTag = 1;
})
2019-04-01 16:53:54.686 [warn][tid:NSOperationQueue 0x60000023a040 (QOS: UNSPECIFIED)][RCTModuleData.mm:248] RCTBridge required dispatch_sync to load RCTDevLoadingView. This may lead to deadlocks
2019-04-01 16:53:55.829 [warn][tid:com.facebook.react.JavaScript] ListView is deprecated and will be removed in a future release. See https://fb.me/nolistview for more information
2019-04-01 16:53:55.958 [warn][tid:com.facebook.react.JavaScript] Use `shouldComponentUpdate` in an `observer` based component breaks the behavior of `observer` and might lead to unexpected results. Manually implementing `sCU` should not be needed when using mobx-react.
2019-04-01 16:53:56.013 [info][tid:com.facebook.react.JavaScript] Running application "pier" with appParams: {"rootTag":1,"initialProps":{}}. __DEV__ === true, development-level warning are ON, performance optimizations are OFF
2019-04-01 16:55:23.125 [info][tid:com.facebook.react.JavaScript] {}
2019-04-01 16:55:23.126 [info][tid:com.facebook.react.JavaScript] GeolocationTrack configuring...
2019-04-01 16:55:23.127 [info][tid:com.facebook.react.JavaScript] { url: 'http://192.168.15.25:8080/',
headers: { authorization: 'XXX' },
params:
{ user_id: 'XXX',
device_id: 'YYY' },
extras: {},
desiredAccuracy: -1,
distanceFilter: 10,
elasticityMultiplier: 1,
stationaryRadius: 25,
disableElasticity: false,
stopAfterElapsedMinutes: 0,
stopOnStationary: false,
desiredOdometerAccuracy: 100,
useSignificantChangesOnly: false,
locationAuthorizationRequest: 'Any',
disableLocationAuthorizationAlert: true,
stopTimeout: 5,
stopDetectionDelay: 0,
disableStopDetection: false,
pausesLocationUpdatesAutomatically: undefined,
activityType: undefined,
disableMotionActivityUpdates: true,
stopOnTerminate: false,
startOnBoot: true,
heartbeatInterval: undefined,
schedule: undefined,
preventSuspend: false,
debug: true,
logLevel: 5,
logMaxDays: 7,
batchSync: true,
autoSync: true,
autoSyncThreshold: 2,
maxBatchSize: 50,
geofenceProximityRadius: 1000,
geofenceInitialTriggerEntry: false,
reset: true }
βΉοΈ-[TSConfig persist]
π΅-[TSLocationManager ready]
2019-04-01 16:55:23.136 [info][tid:com.facebook.react.JavaScript] GeolocationTrack configured and ready
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β -[TSHttpService flush:error:]
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β -[TSHttpService finish:error:] Success: 1
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β -[TSLocationManager start]
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
βΉοΈ-[TSLocationManager doStart:] trackingMode: 1
βΉοΈ-[TSConfig persist]
πΎ-[TSGeofenceManager start]
π΅-[TSLocationManager setPace:] 0
πΎ-[TSLocationManager startUpdatingLocation] Location-services: ON
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β -[TSHttpService flush:error:]
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β -[TSHttpService finish:error:] Success: 1
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
2019-04-01 16:55:23.153 [info][tid:com.facebook.react.JavaScript] 'GeolocationTrack started', { url: [Getter/Setter],
headers: [Getter/Setter],
params: [Getter/Setter],
extras: [Getter/Setter],
desiredAccuracy: [Getter/Setter],
distanceFilter: [Getter/Setter],
elasticityMultiplier: [Getter/Setter],
stationaryRadius: [Getter/Setter],
disableElasticity: [Getter/Setter],
stopAfterElapsedMinutes: [Getter/Setter],
stopOnStationary: [Getter/Setter],
desiredOdometerAccuracy: [Getter/Setter],
useSignificantChangesOnly: [Getter/Setter],
locationAuthorizationRequest: [Getter/Setter],
disableLocationAuthorizationAlert: [Getter/Setter],
stopTimeout: [Getter/Setter],
stopDetectionDelay: [Getter/Setter],
disableStopDetection: [Getter/Setter],
pausesLocationUpdatesAutomatically: [Getter/Setter],
activityType: [Getter/Setter],
disableMotionActivityUpdates: [Getter/Setter],
stopOnTerminate: [Getter/Setter],
startOnBoot: [Getter/Setter],
heartbeatInterval: [Getter/Setter],
schedule: [Getter/Setter],
preventSuspend: [Getter/Setter],
debug: [Getter/Setter],
logLevel: [Getter/Setter],
logMaxDays: [Getter/Setter],
batchSync: [Getter/Setter],
autoSync: [Getter/Setter],
autoSyncThreshold: [Getter/Setter],
maxBatchSize: [Getter/Setter],
geofenceProximityRadius: [Getter/Setter],
geofenceInitialTriggerEntry: [Getter/Setter],
reset: [Getter/Setter] }
βΉοΈ-[TSLocationManager removeListeners]
βΉοΈ-[TSLocationManager on:success:failure:] providerchange
βΉοΈ-[TSLocationManager on:success:failure:] powersavechange
βΉοΈ-[TSHttpService onConnectivityChange:]
βΉοΈ+[LocationAuthorization run:onCancel:] status: 3
πΎ-[TSLocationManager startMonitoringBackgroundFetch] BackgroundFetch: ON
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β -[TSLocationManager startMonitoringBackgroundFetch]_block_invoke Background fetch received
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β -[TSHttpService flush:error:]
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β -[TSHttpService finish:error:] Success: 1
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
2019-04-01 16:55:23.180 [info][tid:com.apple.root.default-qos][RNBackgroundFetch.m:61] - RNBackgroundFetch Rx Fetch Event
2019-04-01 16:55:23.180 [info][tid:com.facebook.react.JavaScript] just fetched stuff
π<+37.41116820,-122.20078524> +/- 5.00m (speed 34.82 mps / course 291.80) @ 4/1/19, 4:55:24 PM Brasilia Standard Time
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β -[TSLocationManager locationManager:didUpdateLocations:] Enabled: 1 | isMoving: 0 | df: -1.0m | age: 0.0s
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β
-[TSLocationManager locationManager:didUpdateLocations:] Acquired motionchange position: <+37.41116820,-122.20078524> +/- 5.00m (speed 34.82 mps / course 291.80) @ 4/1/19, 4:55:24 PM Brasilia Standard Time
π΅-[TSLocationManager startMonitoringStationaryRegion:radius:] Radius: 25
π΄-[TSLocationManager stopUpdatingLocation]
π΅-[TSLocationManager calculateMedianLocationAccuracy:] Median location accuracy: 5.0
πΎ-[TSLocationManager startMonitoringSignificantLocationChanges]
β
-[TSLocationManager persistLocation:]_block_invoke INSERT: E5A85DBD-DFFF-4EAA-835A-3D78C60F7042
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:14 (7 by maintainers)
Top Results From Across the Web
React Native: Simulate Background Fetch disabled
I got Simulate background fetch enabled by going to: Xcode Menu > Product > Scheme > Edit Scheme and change Executable from Ask...
Read more >I can not simulate the background fetch on the device in xcode
when I simulate the background fetch in the simulator it works. But when I test the application on the device connected to xcode...
Read more >Simulate Background Fetch iOS on VisualStudio - MSDN
I want to simulate my backgroundfetch in my iOS project but I don't know ... I am trying it on the real device...
Read more >iOS background processing - Background App Refresh Task
Background App refresh setting: The user can toggle the setting to ... To simulate background fetch, from the tab bar > Debug >...
Read more >Swift iOS BackgroundTasks framework β Background App ...
Go to the βBackground Modesβ session of the app target and check βBackground fetchβ and βBackground processingβ options if BGAppRefreshTask andΒ ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
To add to this discussion, I found a parallel way to test BackgroundFetch:
When using XCodeβs Time Profiler, you can select your appβs process and start recording activity. Then a command to
Simulate Background Fetch
pops up under theInstrument
option in the menu.Is this path as trustworthy as the one we were discussing previously?
Nothing related to this issue, as far as I can tell. The log is as follows: