Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Fetch problem on iOS 17 simulator

Open
#64 1 comment 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
38/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
ios, javascript, swift
Domain
mobile-dev

Research direction

Reproduce the fetchTest handler from runner.js on the iOS 17 simulator and inspect CapacitorBackgroundRunner/BackgroundRunner.swift around line 160. Trace the returnObj.toDictionary() call and identify why the fetch result reaches an implicitly unwrapped nil. Done means the handler completes without the reported crash while resolving or rejecting the request.

Written by the indexing model from the issue text.

Description

I got the following error on iOS simulator:

CapacitorBackgroundRunner/BackgroundRunner.swift:160: Fatal error: Unexpectedly found nil while implicitly unwrapping an Optional value

The problematic code is this:

returnObj.toDictionary().forEach { key, value in. // Line 160
   dict[String(describing: key)] = value
}

My code in the runner.js file:

addEventListener("fetchTest", async (resolve, reject, args) => {
  try {
    const res = await fetch("https://randomuser.me/api/");
    console.log("res???", res);

    resolve('plain text');
  } catch (err) {
    console.error(err);
    reject(err);
  }
});
Dominant language
C
Stars
57
Forks
37
Avg merge
3d 17h
Merged PRs (30d)
3

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from ionic-team/capacitor-background-runner

All issues in ionic-team/capacitor-background-runner

Similar issues

More C issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.