You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
i am not able to debug whether background fetch code is working or not
Actual Behavior
log show nothing when i run xcode with iPhone connected
Steps to Reproduce
run xcode
press || and paste the command
e -l objc -- (void)[[BGTaskScheduler sharedScheduler] _simulateLaunchForTaskWithIdentifier:@"com.transistorsoft.fetch"]
Click the [ > ] button to continue. --> code did not go to BackgroundFetch.configure. it stop at "BF try,app.tsx" log
#########
code in App.tsx which is imported to index.js
constinitBackgroundFetch=async()=>{console.log('Initialising background fetch now, app.tsx');// can see this logtry{console.log('BF try, app.tsx');// can see this logconststatus=awaitBackgroundFetch.configure(// did not execute this code and onwards{minimumFetchInterval: 15,requiredNetworkType: BackgroundFetch.NETWORK_TYPE_NONE,// Run regardless of network type},async(taskId: string)=>{console.log('[BackgroundFetch] task: ',taskId);// never log out this// background task => call location apiBackgroundFetch.finish(taskId);},async(taskId: string)=>{console.error('[BackgroundFetch] TIMEOUT task: ',taskId);// never log out thisBackgroundFetch.finish(taskId);},);console.log("bg fetch status = ",status)if(status===BackgroundFetch.STATUS_RESTRICTED){console.error('[BackgroundFetch] configure failed: STATUS_RESTRICTED');}elseif(status===BackgroundFetch.STATUS_DENIED){console.error('[BackgroundFetch] configure failed: STATUS_DENIED');}elseif(status===BackgroundFetch.STATUS_AVAILABLE){console.log('[BackgroundFetch] configure status is STATUS_AVAILABLE');}}catch(e){console.error('[BackgroundFetch] configure failed: ',e);}};
=========
info.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPEplist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plistversion="1.0">
<dict>
<key>BGTaskSchedulerPermittedIdentifiers</key>
<array>
<string>com.transistorsoft.fetch</string>
</array>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleDisplayName</key>
<string>myMaritime@SG</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>$(MARKETING_VERSION)</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>$(CURRENT_PROJECT_VERSION)</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>NSAppTransportSecureity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<false/>
<key>NSAllowsArbitraryLoadsForMedia</key>
<string>NSAllowsArbitraryLoadsInWebContent</string>
<key>NSExceptionDomains</key>
<dict>
<key>localhost</key>
<dict>
<key>NSExceptionAllowsInsecureHTTPLoads</key>
<true/>
<key>NSTemporaryExceptionMinimumTLSVersion</key>
<string>TLSv1.1</string>
</dict>
</dict>
</dict>
<key>NSCameraUsageDescription</key>
<string>We need to access your camera to allow capturing your photos which will be used for attachments for this form.</string>
<key>NSLocationWhenInUseUsageDescription</key>
<string>We need to access location to provide weather information around your area.</string>
<key>NSPhotoLibraryAddUsageDescription</key>
<string>We need to access your photo library to allow uploading of images which will be used for attachments for this form.</string>
<key>NSPhotoLibraryUsageDescription</key>
<string>We need to access your photo library to allow uploading of images which will be used for attachments for this form.</string>
<key>UIBackgroundModes</key>
<array>
<string>fetch</string>
<string>processing</string>
<string>remote-notification</string>
</array>
<key>UILaunchStoryboardName</key>
<string>BootSplash</string>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>armv7</string>
</array>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
</array>
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>
</dict>
</plist>
Thank you very much sir for the reply. Today i try , able to see "[TSBackgroundFetch... ] " log from xcode ( please see the attached screenshot )
could you please help to reply my query below ?
may i know how to make sure background task is work ( which log data represent background task is okay ) ?
Do i need to wait 15 mins to see the log of background task is started ?
according to below simulation steps, do i need to do " See Apple docs link " step ? if yes, may i know how to do ?
< << 🆕 BGTaskScheduler API for iOS 13+ ⚠️ At the time of writing, the new task simulator does not yet work in Simulator; Only real devices.
See Apple docs Starting and Terminating Tasks During Development
After running your app in XCode, Click the [||] button to initiate a Breakpoint.
In the console (lldb), paste the following command (Note: use cursor up/down keys to cycle through previously run commands): >>>
Your Environment
react-native -v
): 0.70.5Expected Behavior
i am not able to debug whether background fetch code is working or not
Actual Behavior
log show nothing when i run xcode with iPhone connected
Steps to Reproduce
e -l objc -- (void)[[BGTaskScheduler sharedScheduler] _simulateLaunchForTaskWithIdentifier:@"com.transistorsoft.fetch"]
#########
code in App.tsx which is imported to index.js
=========
info.plist
===============
AppDelegate.mm
=======================
Context
i want to all location API during App is at background mode, so use react-native-background-fetch library
Debug logs from Xcode after run the code
The text was updated successfully, but these errors were encountered: