首页 > 解决方案 > 将“GoogleSignIn”添加到框架会崩溃,并出现“未找到架构 x86_64 的符号”

问题描述

我正在尝试将GoogleSignIn库添加到框架项目。

我的项目结构:

- XXX.xcworkspace
- XXXX
    - XXXX.xcproject
- XXXXModel
    - XXXModel.xcproject
- XXXXAmazonAPI
    - XXXAmazonAPI.xcproject
- Podfile

这就是我的 Podfile 的样子:

platform :ios, '10.0'
workspace 'XXX.xcworkspace'
use_frameworks!

# Place all the common pods for targets
def common_pods 
  pod 'PromiseKit', :modular_headers => true
end

target 'XXXX' do 
  project 'XXXX/XXXX.xcodeproj'

  common_pods

  target 'XXXXTests' do 
    inherit! :search_paths

  end

  target 'XXXXUITests' do 
    inherit! :search_paths

  end

end

target 'XXXXModel' do 
  project 'XXXXModel/XXXXModel.xcodeproj'

  common_pods

  target 'XXXXModelTests' do
    inherit! :search_paths 

  end

end

target 'XXXXAmazonAPI' do 
  project 'XXXXAmazonAPI/XXXXAmazonAPI.xcodeproj'

  common_pods

  pod 'AWSCore'
  pod 'AWSMobileClient'
  pod 'AWSAuthCore'
  pod 'AWSGoogleSignIn'
  pod 'AWSFacebookSignIn'
  pod 'AWSUserPoolsSignIn'

  pod 'GoogleSignIn'
  pod 'FBSDKLoginKit'

  target 'XXXXAmazonAPITests' do 
    inherit! :search_paths

  end

end

当我pod install尝试构建项目时,它会因错误而崩溃:

Undefined symbols for architecture x86_64:
  "_CGFontCreateWithDataProvider", referenced from:
      ___45+[NSBundle(GID3PAdditions) gid_registerFonts]_block_invoke in GoogleSignIn(NSBundle+GID3PAdditions_ced5da3f7b3f618f4940e63de013ecaf.o)
  "_UIApplicationDidEnterBackgroundNotification", referenced from:
      -[MDMPasscodeCache init] in GoogleSignIn(MDMPasscodeCache_42de90102bb6814d03833694aafcc99d.o)
  "_OBJC_METACLASS_$_UIViewController", referenced from:
      _OBJC_METACLASS_$_GIDSignInWebViewController in GoogleSignIn(GIDSignInWebViewController_f7f89adeb6daf6502440d85b750eb00c.o)
  "_OBJC_CLASS_$_UIBarButtonItem", referenced from:
      objc-class-ref in GoogleSignIn(GIDSignInWebViewController_f7f89adeb6daf6502440d85b750eb00c.o)
  "_OBJC_CLASS_$_UIWebView", referenced from:
      objc-class-ref in GoogleSignIn(GIDSignInWebView_1321a9d44d461432c165fb69716cee1c.o)
  "_OBJC_CLASS_$_UIView", referenced from:
      _OBJC_CLASS_$_GIDSignInWebView in GoogleSignIn(GIDSignInWebView_1321a9d44d461432c165fb69716cee1c.o)
  "_CGContextFillPath", referenced from:
      -[GIDSignInButton drawButtonBackground:] in GoogleSignIn(GIDSignInButton_40b3cd8d3ca7b892c701e248656f34e3.o)
  "_CGRectZero", referenced from:
      -[GIDSignInWebView createWebView] in GoogleSignIn(GIDSignInWebView_1321a9d44d461432c165fb69716cee1c.o)
  "_UIGraphicsBeginImageContextWithOptions", referenced from:
      -[UIImage(GIDAdditions_Private) gid_imageWithBlendMode:color:] in GoogleSignIn(GIDSignInButton_40b3cd8d3ca7b892c701e248656f34e3.o)
  "_CGContextSetShouldAntialias", referenced from:
      -[UIImage(GIDAdditions_Private) gid_imageWithBlendMode:color:] in GoogleSignIn(GIDSignInButton_40b3cd8d3ca7b892c701e248656f34e3.o)
  "_OBJC_CLASS_$_UIActivityIndicatorView", referenced from:
      objc-class-ref in GoogleSignIn(GIDSignInWebView_1321a9d44d461432c165fb69716cee1c.o)
  "_UIWindowLevelAlert", referenced from:
      ___57-[GIDEMMErrorHandler handleErrorFromResponse:completion:]_block_invoke in GoogleSignIn(GIDEMMErrorHandler_08c50849aae099317ac5d938cd28d2ea.o)
  "_CGContextSetInterpolationQuality", referenced from:
      -[UIImage(GIDAdditions_Private) gid_imageWithBlendMode:color:] in GoogleSignIn(GIDSignInButton_40b3cd8d3ca7b892c701e248656f34e3.o)
  "_UIApplicationOpenSettingsURLString", referenced from:
      ___58-[GIDEMMErrorHandler passcodeRequiredAlertWithCompletion:]_block_invoke.124 in GoogleSignIn(GIDEMMErrorHandler_08c50849aae099317ac5d938cd28d2ea.o)
  "_OBJC_METACLASS_$_UIControl", referenced from:
      _OBJC_METACLASS_$_GIDSignInButton in GoogleSignIn(GIDSignInButton_40b3cd8d3ca7b892c701e248656f34e3.o)
  "_CGContextDrawImage", referenced from:
      -[UIImage(GIDAdditions_Private) gid_imageWithBlendMode:color:] in GoogleSignIn(GIDSignInButton_40b3cd8d3ca7b892c701e248656f34e3.o)
  "_CGRectInset", referenced from:
      -[GIDSignInButton drawButtonBackground:] in GoogleSignIn(GIDSignInButton_40b3cd8d3ca7b892c701e248656f34e3.o)
  "_CGContextSetBlendMode", referenced from:
      -[UIImage(GIDAdditions_Private) gid_imageWithBlendMode:color:] in GoogleSignIn(GIDSignInButton_40b3cd8d3ca7b892c701e248656f34e3.o)
  "_UIGraphicsGetImageFromCurrentImageContext", referenced from:
      -[UIImage(GIDAdditions_Private) gid_imageWithBlendMode:color:] in GoogleSignIn(GIDSignInButton_40b3cd8d3ca7b892c701e248656f34e3.o)
  "_NSForegroundColorAttributeName", referenced from:
      -[GIDSignInButton drawButtonText:] in GoogleSignIn(GIDSignInButton_40b3cd8d3ca7b892c701e248656f34e3.o)
  "_CGDataProviderRelease", referenced from:
      ___45+[NSBundle(GID3PAdditions) gid_registerFonts]_block_invoke in GoogleSignIn(NSBundle+GID3PAdditions_ced5da3f7b3f618f4940e63de013ecaf.o)
  "_OBJC_CLASS_$_UINavigationController", referenced from:
      objc-class-ref in GoogleSignIn(GIDSignIn_f05654be6d1b2af59ab6df426a0c4eb9.o)
  "_CGContextFillRect", referenced from:
      -[UIImage(GIDAdditions_Private) gid_imageWithBlendMode:color:] in GoogleSignIn(GIDSignInButton_40b3cd8d3ca7b892c701e248656f34e3.o)
  "_CGContextScaleCTM", referenced from:
      -[GIDSignInButton drawButtonBackground:] in GoogleSignIn(GIDSignInButton_40b3cd8d3ca7b892c701e248656f34e3.o)
      -[UIImage(GIDAdditions_Private) gid_imageWithBlendMode:color:] in GoogleSignIn(GIDSignInButton_40b3cd8d3ca7b892c701e248656f34e3.o)
  "_CGContextTranslateCTM", referenced from:
      -[GIDSignInButton drawButtonBackground:] in GoogleSignIn(GIDSignInButton_40b3cd8d3ca7b892c701e248656f34e3.o)
      -[UIImage(GIDAdditions_Private) gid_imageWithBlendMode:color:] in GoogleSignIn(GIDSignInButton_40b3cd8d3ca7b892c701e248656f34e3.o)
  "_OBJC_CLASS_$_UIColor", referenced from:
      objc-class-ref in GoogleSignIn(GIDEMMErrorHandler_08c50849aae099317ac5d938cd28d2ea.o)
      objc-class-ref in GoogleSignIn(GIDSignInButton_40b3cd8d3ca7b892c701e248656f34e3.o)
      objc-class-ref in GoogleSignIn(GIDSignInWebView_1321a9d44d461432c165fb69716cee1c.o)
  "_UIGraphicsEndImageContext", referenced from:
      -[UIImage(GIDAdditions_Private) gid_imageWithBlendMode:color:] in GoogleSignIn(GIDSignInButton_40b3cd8d3ca7b892c701e248656f34e3.o)
  "_CGFontRelease", referenced from:
      ___45+[NSBundle(GID3PAdditions) gid_registerFonts]_block_invoke in GoogleSignIn(NSBundle+GID3PAdditions_ced5da3f7b3f618f4940e63de013ecaf.o)
  "_CGContextSaveGState", referenced from:
      -[GIDSignInButton drawButtonBackground:] in GoogleSignIn(GIDSignInButton_40b3cd8d3ca7b892c701e248656f34e3.o)
  "_CGContextSetShadowWithColor", referenced from:
      -[GIDSignInButton drawButtonBackground:] in GoogleSignIn(GIDSignInButton_40b3cd8d3ca7b892c701e248656f34e3.o)
  "_CGPathCreateMutable", referenced from:
      -[GIDSignInButton drawButtonBackground:] in GoogleSignIn(GIDSignInButton_40b3cd8d3ca7b892c701e248656f34e3.o)
  "_OBJC_METACLASS_$_UIView", referenced from:
      _OBJC_METACLASS_$_GIDSignInWebView in GoogleSignIn(GIDSignInWebView_1321a9d44d461432c165fb69716cee1c.o)
  "_CGPathAddRoundedRect", referenced from:
      -[GIDSignInButton drawButtonBackground:] in GoogleSignIn(GIDSignInButton_40b3cd8d3ca7b892c701e248656f34e3.o)
  "_CGPathRelease", referenced from:
      -[GIDSignInButton drawButtonBackground:] in GoogleSignIn(GIDSignInButton_40b3cd8d3ca7b892c701e248656f34e3.o)
  "_OBJC_CLASS_$_UIDevice", referenced from:
      objc-class-ref in GoogleSignIn(GIDAuthentication_7b83cc27af8929ec7e4c9760d73a0f31.o)
      objc-class-ref in GoogleSignIn(GIDEMMErrorHandler_08c50849aae099317ac5d938cd28d2ea.o)
  "_OBJC_CLASS_$_UIImage", referenced from:
      objc-class-ref in GoogleSignIn(GIDSignInButton_40b3cd8d3ca7b892c701e248656f34e3.o)
      l_OBJC_$_CATEGORY_UIImage_$_GIDAdditions_Private in GoogleSignIn(GIDSignInButton_40b3cd8d3ca7b892c701e248656f34e3.o)
  "_OBJC_CLASS_$_UIApplication", referenced from:
      objc-class-ref in GoogleSignIn(GIDEMMErrorHandler_08c50849aae099317ac5d938cd28d2ea.o)
      objc-class-ref in GoogleSignIn(GIDSignIn_f05654be6d1b2af59ab6df426a0c4eb9.o)
  "_CGDataProviderCreateWithFilename", referenced from:
      ___45+[NSBundle(GID3PAdditions) gid_registerFonts]_block_invoke in GoogleSignIn(NSBundle+GID3PAdditions_ced5da3f7b3f618f4940e63de013ecaf.o)
  "_OBJC_CLASS_$_UIAlertAction", referenced from:
      objc-class-ref in GoogleSignIn(GIDEMMErrorHandler_08c50849aae099317ac5d938cd28d2ea.o)
  "_CGContextRestoreGState", referenced from:
      -[GIDSignInButton drawButtonBackground:] in GoogleSignIn(GIDSignInButton_40b3cd8d3ca7b892c701e248656f34e3.o)
  "_CGContextRelease", referenced from:
      -[GIDSignInButton drawRect:] in GoogleSignIn(GIDSignInButton_40b3cd8d3ca7b892c701e248656f34e3.o)
  "_CGRectEqualToRect", referenced from:
      -[GIDSignInButton setFrame:] in GoogleSignIn(GIDSignInButton_40b3cd8d3ca7b892c701e248656f34e3.o)
  "_CGContextClipToMask", referenced from:
      -[UIImage(GIDAdditions_Private) gid_imageWithBlendMode:color:] in GoogleSignIn(GIDSignInButton_40b3cd8d3ca7b892c701e248656f34e3.o)
  "_UIAccessibilityTraitButton", referenced from:
      -[GIDSignInButton sharedInit] in GoogleSignIn(GIDSignInButton_40b3cd8d3ca7b892c701e248656f34e3.o)
  "_UIGraphicsGetCurrentContext", referenced from:
      -[GIDSignInButton drawRect:] in GoogleSignIn(GIDSignInButton_40b3cd8d3ca7b892c701e248656f34e3.o)
      -[UIImage(GIDAdditions_Private) gid_imageWithBlendMode:color:] in GoogleSignIn(GIDSignInButton_40b3cd8d3ca7b892c701e248656f34e3.o)
  "_OBJC_CLASS_$_UIControl", referenced from:
      _OBJC_CLASS_$_GIDSignInButton in GoogleSignIn(GIDSignInButton_40b3cd8d3ca7b892c701e248656f34e3.o)
  "_UIApplicationDidBecomeActiveNotification", referenced from:
      -[GIDSignIn init] in GoogleSignIn(GIDSignIn_f05654be6d1b2af59ab6df426a0c4eb9.o)
      -[GIDSignIn dealloc] in GoogleSignIn(GIDSignIn_f05654be6d1b2af59ab6df426a0c4eb9.o)
  "_OBJC_CLASS_$_UIAlertController", referenced from:
      objc-class-ref in GoogleSignIn(GIDEMMErrorHandler_08c50849aae099317ac5d938cd28d2ea.o)
  "_NSFontAttributeName", referenced from:
      -[GIDSignInButton drawButtonText:] in GoogleSignIn(GIDSignInButton_40b3cd8d3ca7b892c701e248656f34e3.o)
      +[GIDSignInButton textSize:withFont:] in GoogleSignIn(GIDSignInButton_40b3cd8d3ca7b892c701e248656f34e3.o)
  "_OBJC_CLASS_$_UIWindow", referenced from:
      objc-class-ref in GoogleSignIn(GIDEMMErrorHandler_08c50849aae099317ac5d938cd28d2ea.o)
  "_OBJC_CLASS_$_UIViewController", referenced from:
      objc-class-ref in GoogleSignIn(GIDEMMErrorHandler_08c50849aae099317ac5d938cd28d2ea.o)
      objc-class-ref in GoogleSignIn(GIDSignIn_f05654be6d1b2af59ab6df426a0c4eb9.o)
      _OBJC_CLASS_$_GIDSignInWebViewController in GoogleSignIn(GIDSignInWebViewController_f7f89adeb6daf6502440d85b750eb00c.o)
  "_CGContextAddPath", referenced from:
      -[GIDSignInButton drawButtonBackground:] in GoogleSignIn(GIDSignInButton_40b3cd8d3ca7b892c701e248656f34e3.o)
  "_CGContextRetain", referenced from:
      -[GIDSignInButton drawRect:] in GoogleSignIn(GIDSignInButton_40b3cd8d3ca7b892c701e248656f34e3.o)
  "_OBJC_CLASS_$_UIScreen", referenced from:
      objc-class-ref in GoogleSignIn(GIDEMMErrorHandler_08c50849aae099317ac5d938cd28d2ea.o)
      objc-class-ref in GoogleSignIn(GIDSignInWebViewController_f7f89adeb6daf6502440d85b750eb00c.o)
  "_CGContextSetFillColorWithColor", referenced from:
      -[GIDSignInButton drawButtonBackground:] in GoogleSignIn(GIDSignInButton_40b3cd8d3ca7b892c701e248656f34e3.o)
      -[UIImage(GIDAdditions_Private) gid_imageWithBlendMode:color:] in GoogleSignIn(GIDSignInButton_40b3cd8d3ca7b892c701e248656f34e3.o)
  "_OBJC_CLASS_$_UIImageView", referenced from:
      objc-class-ref in GoogleSignIn(GIDSignInButton_40b3cd8d3ca7b892c701e248656f34e3.o)
  "_CGRectIsEmpty", referenced from:
      ___57-[GIDEMMErrorHandler handleErrorFromResponse:completion:]_block_invoke in GoogleSignIn(GIDEMMErrorHandler_08c50849aae099317ac5d938cd28d2ea.o)
  "_OBJC_CLASS_$_UIFont", referenced from:
      objc-class-ref in GoogleSignIn(GIDSignInButton_40b3cd8d3ca7b892c701e248656f34e3.o)
      objc-class-ref in GoogleSignIn(NSBundle+GID3PAdditions_ced5da3f7b3f618f4940e63de013ecaf.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

最后一行说:

ld: symbol(s) not found for architecture x86_64
    clang: error: linker command failed with exit code 1 (use -v to see invocation)

我已经使用 Target Dependencies 设置了工作区。

这是在带有 iOS 目标 10.0 的 xcode 10.0 上

编辑:当我尝试在真正的 iOS 设备上运行它时,我遇到了同样的问题。

ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

标签: iosgoogle-signin

解决方案


添加-ObjCOTHER_LDFLAGS解决问题。记录在这里: https ://firebase.google.com/docs/ios/setup


推荐阅读