Can someone supply the correct use of match?

I’ve been struggling for a long time trying to get CircleCI to work for iOS and I’ve been getting nothing but errors.

I’ve looked at the fragmented documentation and blog posts that provide partial answers and can’t piece it all together. Can someone please tell me the correct way to build the fastfile and not give a partial answer?

The official docs say I can use:
desc “Ad-hoc build”
lane :adhoc do
match(type: “adhoc”)
gym(export_method: “ad-hoc”)
end

which is not the correct way to create the fastfile because it gives the error:

No code signing identity found and can not create a new one because you enabled readonly

I’ve tried using the solution from this:
https://medium.com/@m4rr/circleci-2-0-and-the-ios-code-signing-df434d0086e2
but it doesn’t work, CircleCI tells me that there is an incorrect parameter in import_certificate and won’t tell me what’s wrong.

I’ve tried creating a Matchfile supplying an SSH git url, type, app identifier, and username but that too doesn’t work.

I’m at a loss because I can’t figure out what the correct fastfile is to make CircleCI work.

Something like this should work

default_platform(:ios)

before_all do
  setup_circle_ci
end

lane :adhoc_match do
  match(
    type: "adhoc",
    app_identifier: "insert bundle identifier",
    readonly: is_ci
  )
end