Apollo auto generate code when compile getting more issues Cannot find type 'schemaName' in scope?

I am using apollo IOS v1.0 documents and try to fetch query and mutation but getting more issues “Cannot find type ‘VmaxsAPI’ in scope” in auto generated code

Hi @MohanVMaxIOS, I think that’s going to depend on your JSON codegen configuration and how the schema module is being output.

Hi @calvincestari ,

Thank you for your quick response .

“VmaxsAPI”. This is called schema name when i generate Create a codegen configuration
./apollo-ios-cli init --schema-name StarWarsAPI --module-type swiftPackageManager
But project root name is different “VMaxGraphQL”. when i change manual it working .

{
  "schemaName" : "VmaxsAPI",
  "input" : {
    "operationSearchPaths" : [
      "**/*.graphql"
    ],
    "schemaSearchPaths" : [
      "**/*.graphqls"
    ]
  },
  "output" : {
    "testMocks" : {
      "none" : {
      }
    },
    "schemaTypes" : {
      "path" : "./VmaxsAPI",
      "moduleType" : {
        "swiftPackageManager" : {
        }
      }
    },
    "operations" : {
      "inSchemaModule" : {
      }
    }
  }
}

Thanks

Thanks

Are you manually adding the “Sources” folder to your project? You generated a Swift package and therefore you must add it to your project as a new SPM dependency, the same was you added Apollo iOS. The only difference is this time it is a local package.

VmaxsAPI is the name of the Swift package (module) it’s looking for.

1 Like

Hi,

I also encountered the same problem.
But I use cocoapods.

My file content looks like this:

Can you see what the problem is from the above pictures?

Thank you so much!

This same problem,
I also added the automatically generated code to the project.

I am also getting the same issue,Can you please help me what thing i am doing wrong?

Hi @Shashank_Panwar - I replied in the GitHub issue.