Unable to load mmpk file in debug build using iPad.

328
0
05-31-2023 02:06 AM
funabiki
New Contributor

# Situation

  • When building with the simulator
    • When built from Xcode, it can load.
    • When the app is launched from the home screen, it cannot be loaded.
  • When building with the device
    • Cannot load either time.

 

# Device info

  • iPad Pro (11-inch) 2gen
  • iPad OS (15.0.1)
  • Xcode 14.1

 

# Library info

  • arcgis-runtime-ios (100.15.2)

 

# App stracture

 

This application uses a multi-module structure.

 

  • ArcGISAppKit // install arcgis-runtime-ios here
  • ArcGISApp
  • Pods
  • ...

 

ArcGISAppKit/Package.swift

import PackageDescription

 

let package = Package(

    name: "ArcGISAppKit",

    platforms: [

        .iOS(.v15)

    ],

    products: [

        // Products define the executables and libraries a package produces, and make them visible to other packages.

        .library(

            name: "ArcGISAppKit",

            targets: ["ArcGISAppKit"]),

    ],

    dependencies: [

        .package(url: "https://github.com/esri/arcgis-runtime-ios", from: "100.15.2"),

        .package(url: "https://github.com/Esri/arcgis-runtime-toolkit-ios", from: "100.15.0"),

    ],

    targets: [

        .target(

            name: "ArcGISAppKit",

            dependencies: [

                .product(name: "ArcGIS", package: "arcgis-runtime-ios"),

                .product(name: "ArcGISToolkit", package: "arcgis-runtime-toolkit-ios"),

            ]

        ),

        .testTarget(

            name: "ArcGISAppKitTests",

            dependencies: ["ArcGISAppKit"]

        ),

    ]

)

 

# Affected code

 

// Called when ViewController is initialized

func load(mapPackage: AGSMobileMapPackage) async throws -> [AGSLayer] {

  try await mapPackage.load()  // an error occurs bud this method throws nothing

  guard mapPackage.loadStatus == .loaded else {

    throw .loadStatusError

  }

  guard let mobileMap = mapPackage.maps.first,

              let layers = mobileMap.operationalLayers as? [AGSLayer] else {

                throw .noDataError

  }

  mobileMap.operationalLayers.removeAllObjects()

  let groupLayers = layers.compactMap { $0 as? AGSGroupLayer }

  let featureLayers = layers.compactMap { $0 as? AGSFeatureLayer }

  try await groupLayers.asyncForEach { layer in

    try await layer.load()

  }

  try await featureLayers.asyncForEach { layer in

    try await layer.load()

    switch layer.name {

    case "DestinationPoint":

      let result = try await layer.featureTable?.queryFeatures(with: AGSQueryParameters())

      destinationPointLocationList += result?.featureEnumerator().allObjects.compactMap(\.geometry?.extent.center) ?? []

    default:

      break

    }

  }

  return groupLayers + featureLayers

}

 

# Errors output to console

2023-05-31 16:51:06.425313+0900 ArcGISApp[14607:3618492] Metal API Validation Enabled

2023-05-31 16:51:06.947983+0900 ArcGISApp[14607:3618492] ArcGIS Runtime Error Occurred. Set a breakpoint on C++ exceptions to see the original callstack and context for this error:  Error Domain=com.esri.arcgis.runtime.error Code=18 "Internal error." UserInfo={NSLocalizedFailureReason=Could not load Metal shader library from '/private/var/containers/Bundle/Application/93F38F17-7CA9-49ED-BA26-6AD3AB71015A/ArcGISApp.app/Frameworks/ArcGIS.framework/shaders/re_texture_draw_vs.metallib'. Message: library not found, NSLocalizedDescription=Internal error., Additional Message=Could not load Metal shader library from '/private/var/containers/Bundle/Application/93F38F17-7CA9-49ED-BA26-6AD3AB71015A/ArcGISApp.app/Frameworks/ArcGIS.framework/shaders/re_texture_draw_vs.metallib'. Message: library not found}

2023-05-31 16:53:27.197459+0900 ArcGISApp[14607:3618602] XPC connection interrupted

0 Kudos
0 Replies