You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

集成自研GoogleMaps依赖框架至Demo时遇架构错误求助

Fixing "ld: framework not found GoogleMaps for architecture" When Integrating Your Custom Framework

Hey there, let's troubleshoot this linker error step by step—this is a common issue when dealing with framework dependencies, so we'll get you sorted out.

Possible Solutions to Try

1. Verify Your Custom Framework's Dependency Setup

First, double-check how your MHikes_SDK_Navigation framework handles the Google Maps dependency:

  • If your framework is static: The Demo project needs to directly include the Google Maps framework (either manually or via CocoaPods/Carthage), since static frameworks don't embed their dependencies. Make sure Google Maps is added to the Demo's Link Binary With Libraries build phase.
  • If your framework is dynamic: Ensure Google Maps is set to Embed & Sign in your framework's Build Phases > Embed Frameworks section. If you're using CocoaPods to manage dependencies in your framework, confirm the Podfile includes pod 'GoogleMaps' and that the framework builds with this dependency correctly.

2. Audit Demo Project's Build Settings

Even if you checked Framework Search Paths, dig a bit deeper:

  • Go to your Demo project's Build Settings > Framework Search Paths:
    • Confirm the path to the Google Maps framework is included (either absolute or relative—using $(SRCROOT) for relative paths is safer).
    • Make sure the path is applied to all build configurations (Debug and Release), not just one.
  • Check Other Linker Flags: Ensure -framework GoogleMaps is present here. If your framework uses CocoaPods, this should be added automatically, but manual setups might miss it.

3. Address Architecture Mismatches

The error mentions "for architecture," so let's rule out architecture issues:

  • Check your Demo project's Build Settings > Valid Architectures: Ensure it includes architectures supported by Google Maps (e.g., arm64 for iOS devices, x86_64 for simulators on Intel Macs, arm64 for simulators on Apple Silicon).
  • If you're on an Apple Silicon Mac: Try enabling Open using Rosetta for Xcode (right-click Xcode in Finder > Get Info > check the box) to rule out simulator architecture conflicts.
  • Confirm the Google Maps framework you're using supports the architecture you're targeting (download the latest version from Google if needed—older versions might lack support for newer architectures).

4. Clean and Rebuild to Clear Caches

Sometimes stale build data causes linker issues:

  • Clean the build folder: Press Cmd + Shift + K in Xcode.
  • Delete Derived Data: Go to Xcode > Preferences > Locations > Derived Data and click the arrow to open the folder, then delete its contents.
  • Quit Xcode entirely, reopen your Demo project, and rebuild.

5. Validate Framework Integration Steps

Double-check you didn't miss any integration steps:

  • Ensure the GoogleMaps.framework is correctly added to your Demo project (drag-and-drop into the project navigator, and make sure "Copy items if needed" is checked).
  • Confirm that in the Demo's Build Phases > Link Binary With Libraries, both MHikes_SDK_Navigation and GoogleMaps are listed.

Final Note

Your AppDelegate code for setting the Google Maps key looks fine—this linker error is unrelated to the key configuration, so we can focus on the dependency and build setup issues above.

内容的提问来源于stack exchange,提问作者Walid Sassi

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.15 03:32:35