添加了Category并获得了35个链接器错误

时间:2012-12-04 15:43:46

标签: iphone ios linker-errors objective-c-category

我遇到链接器错误的问题,我似乎无法解决或找到问题的原因。我在我的iOS项目中添加了Category,名为ParentViewController+CoreData。我没有在.h.m文件中向此类别添加任何内容,但如果我将其导入另一个文件,则会收到35个链接器错误。 ParentViewController是我的代码中的视图控制器,我想为其创建一个类别。如果我从标准视图控制器创建一个类别,我没有问题。我过去从自定义视图控制器制作了类别没有问题,我在这里找不到问题。

以下是链接器错误:

Ld /Users/Heather/Library/Developer/Xcode/DerivedData/Lodge-dffwatcyrvyekkdhbejusjleqkjn/Build/Products/Debug-iphonesimulator/Lodge.app/Lodge normal i386
    cd /Users/Heather/Documents/lodge
    setenv IPHONEOS_DEPLOYMENT_TARGET 5.1
    setenv PATH "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch i386 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator6.0.sdk -L/Users/Heather/Library/Developer/Xcode/DerivedData/Lodge-dffwatcyrvyekkdhbejusjleqkjn/Build/Products/Debug-iphonesimulator -L/Users/Heather/Documents/lodge -F/Users/Heather/Library/Developer/Xcode/DerivedData/Lodge-dffwatcyrvyekkdhbejusjleqkjn/Build/Products/Debug-iphonesimulator -filelist /Users/Heather/Library/Developer/Xcode/DerivedData/Lodge-dffwatcyrvyekkdhbejusjleqkjn/Build/Intermediates/Lodge.build/Debug-iphonesimulator/Lodge.build/Objects-normal/i386/Lodge.LinkFileList -Xlinker -objc_abi_version -Xlinker 2 -ObjC -all_load -fobjc-link-runtime -Xlinker -no_implicit_dylibs -mios-simulator-version-min=5.1 -framework CoreData -lz -framework CoreGraphics -framework SystemConfiguration -framework MobileCoreServices -framework CFNetwork -framework QuickLook -framework CoreLocation -framework MessageUI -framework ImageIO -lxml2 -framework CoreText -framework Security -framework QuartzCore -framework UIKit -framework Foundation -lFlurryAnalytics -o /Users/Heather/Library/Developer/Xcode/DerivedData/Lodge-dffwatcyrvyekkdhbejusjleqkjn/Build/Products/Debug-iphonesimulator/Lodge.app/Lodge

Undefined symbols for architecture i386:
  "_kGTMHTTPFetcherErrorChallengeKey", referenced from:
      -[GTMHTTPFetcher connection:didReceiveAuthenticationChallenge:] in GTMHTTPFetcher.o
  "_kGTMHTTPFetcherErrorDomain", referenced from:
      -[GTMHTTPFetcher failToBeginFetchWithError:] in GTMHTTPFetcher.o
      -[GTMHTTPFetcher backgroundFetchExpired] in GTMHTTPFetcher.o
      -[GTMHTTPFetcher connection:didReceiveAuthenticationChallenge:] in GTMHTTPFetcher.o
      -[GTMHTTPUploadFetcher uploadNextChunkWithOffset:fetcherProperties:] in GTMHTTPUploadFetcher.o
      -[GTMHTTPFetcher failToBeginFetchWithError:] in GTMHTTPFetcher.o
      -[GTMHTTPFetcher backgroundFetchExpired] in GTMHTTPFetcher.o
      -[GTMHTTPFetcher connection:didReceiveAuthenticationChallenge:] in GTMHTTPFetcher.o
      -[GTMHTTPUploadFetcher uploadNextChunkWithOffset:fetcherProperties:] in GTMHTTPUploadFetcher.o
  "_kGTMHTTPFetcherRetryDelayStartedNotification", referenced from:
      -[GTMHTTPFetcher primeRetryTimerWithNewTimeInterval:] in GTMHTTPFetcher.o
  "_kGTMHTTPFetcherRetryDelayStoppedNotification", referenced from:
      -[GTMHTTPFetcher destroyRetryTimer] in GTMHTTPFetcher.o
  "_kGTMHTTPFetcherStartedNotification", referenced from:
      -[GTMHTTPFetcher beginFetchMayDelay:mayAuthorize:] in GTMHTTPFetcher.o
  "_kGTMHTTPFetcherStatusDataKey", referenced from:
      -[GTMHTTPFetcher connectionDidFinishLoading:] in GTMHTTPFetcher.o
      -[GTMHTTPFetcher shouldRetryNowForStatus:error:] in GTMHTTPFetcher.o
  "_kGTMHTTPFetcherStatusDomain", referenced from:
      -[GTMHTTPFetcher connection:didReceiveData:] in GTMHTTPFetcher.o
      -[GTMHTTPFetcher connectionDidFinishLoading:] in GTMHTTPFetcher.o
      -[GTMHTTPFetcher isRetryError:] in GTMHTTPFetcher.o
      -[GTMHTTPFetcher shouldRetryNowForStatus:error:] in GTMHTTPFetcher.o
      -[GTMHTTPUploadFetcher connectionDidFinishLoading:] in GTMHTTPUploadFetcher.o
      -[GTMHTTPUploadFetcher chunkFetcher:finishedWithData:error:] in GTMHTTPUploadFetcher.o
      -[GTMHTTPUploadFetcher chunkFetcher:willRetry:forError:] in GTMHTTPUploadFetcher.o
      ...
      -[GTMHTTPFetcher connection:didReceiveData:] in GTMHTTPFetcher.o
      -[GTMHTTPFetcher connectionDidFinishLoading:] in GTMHTTPFetcher.o
      -[GTMHTTPFetcher isRetryError:] in GTMHTTPFetcher.o
      -[GTMHTTPFetcher shouldRetryNowForStatus:error:] in GTMHTTPFetcher.o
      -[GTMHTTPUploadFetcher connectionDidFinishLoading:] in GTMHTTPUploadFetcher.o
      -[GTMHTTPUploadFetcher chunkFetcher:finishedWithData:error:] in GTMHTTPUploadFetcher.o
      -[GTMHTTPUploadFetcher chunkFetcher:willRetry:forError:] in GTMHTTPUploadFetcher.o
      ...
      -[GTMHTTPFetcher connection:didReceiveData:] in GTMHTTPFetcher.o
      -[GTMHTTPFetcher connectionDidFinishLoading:] in GTMHTTPFetcher.o
      -[GTMHTTPFetcher isRetryError:] in GTMHTTPFetcher.o
      -[GTMHTTPFetcher shouldRetryNowForStatus:error:] in GTMHTTPFetcher.o
      -[GTMHTTPUploadFetcher connectionDidFinishLoading:] in GTMHTTPUploadFetcher.o
      -[GTMHTTPUploadFetcher chunkFetcher:finishedWithData:error:] in GTMHTTPUploadFetcher.o
      -[GTMHTTPUploadFetcher chunkFetcher:willRetry:forError:] in GTMHTTPUploadFetcher.o
      ...
      -[GTMHTTPFetcher connection:didReceiveData:] in GTMHTTPFetcher.o
      -[GTMHTTPFetcher connectionDidFinishLoading:] in GTMHTTPFetcher.o
      -[GTMHTTPFetcher isRetryError:] in GTMHTTPFetcher.o
      -[GTMHTTPFetcher shouldRetryNowForStatus:error:] in GTMHTTPFetcher.o
      -[GTMHTTPUploadFetcher connectionDidFinishLoading:] in GTMHTTPUploadFetcher.o
      -[GTMHTTPUploadFetcher chunkFetcher:finishedWithData:error:] in GTMHTTPUploadFetcher.o
      -[GTMHTTPUploadFetcher chunkFetcher:willRetry:forError:] in GTMHTTPUploadFetcher.o
      ...
  "_kGTMHTTPFetcherStoppedNotification", referenced from:
      -[GTMHTTPFetcher sendStopNotificationIfNeeded] in GTMHTTPFetcher.o
  "_kGTMOAuth2AccessTokenRefreshed", referenced from:
      -[GTMOAuth2Authentication auth:finishedRefreshWithFetcher:error:] in GTMOAuth2Authentication.o
  "_kGTMOAuth2ErrorDomain", referenced from:
      -[GTMOAuth2Authentication authorizeRequestImmediateArgs:] in GTMOAuth2Authentication.o
      -[GTMOAuth2SignIn windowWasClosed] in GTMOAuth2SignIn.o
      -[GTMOAuth2SignIn handleCallbackReached] in GTMOAuth2SignIn.o
      -[GTMOAuth2Authentication authorizeRequestImmediateArgs:] in GTMOAuth2Authentication.o
      -[GTMOAuth2SignIn windowWasClosed] in GTMOAuth2SignIn.o
      -[GTMOAuth2SignIn handleCallbackReached] in GTMOAuth2SignIn.o
  "_kGTMOAuth2ErrorJSONKey", referenced from:
      -[GTMOAuth2Authentication tokenFetcher:finishedWithData:error:] in GTMOAuth2Authentication.o
  "_kGTMOAuth2ErrorMessageKey", referenced from:
      -[GTMOAuth2SignIn handleCallbackReached] in GTMOAuth2SignIn.o
  "_kGTMOAuth2ErrorRequestKey", referenced from:
      -[GTMOAuth2Authentication authorizeRequestImmediateArgs:] in GTMOAuth2Authentication.o
  "_kGTMOAuth2FetchStarted", referenced from:
      -[GTMOAuth2Authentication notifyFetchIsRunning:fetcher:type:] in GTMOAuth2Authentication.o
  "_kGTMOAuth2FetchStopped", referenced from:
      -[GTMOAuth2Authentication notifyFetchIsRunning:fetcher:type:] in GTMOAuth2Authentication.o
  "_kGTMOAuth2FetchTypeAssertion", referenced from:
      -[GTMOAuth2Authentication beginTokenFetchWithDelegate:didFinishSelector:] in GTMOAuth2Authentication.o
  "_kGTMOAuth2FetchTypeKey", referenced from:
      -[GTMOAuth2Authentication notifyFetchIsRunning:fetcher:type:] in GTMOAuth2Authentication.o
  "_kGTMOAuth2FetchTypeRefresh", referenced from:
      -[GTMOAuth2Authentication beginTokenFetchWithDelegate:didFinishSelector:] in GTMOAuth2Authentication.o
  "_kGTMOAuth2FetchTypeToken", referenced from:
      -[GTMOAuth2Authentication beginTokenFetchWithDelegate:didFinishSelector:] in GTMOAuth2Authentication.o
  "_kGTMOAuth2FetchTypeUserInfo", referenced from:
      -[GTMOAuth2SignIn fetchGoogleUserInfo] in GTMOAuth2SignIn.o
  "_kGTMOAuth2FetcherKey", referenced from:
      -[GTMOAuth2Authentication notifyFetchIsRunning:fetcher:type:] in GTMOAuth2Authentication.o
  "_kGTMOAuth2KeychainErrorDomain", referenced from:
      -[GTMOAuth2Keychain passwordForService:account:error:] in GTMOAuth2ViewControllerTouch.o
      -[GTMOAuth2Keychain removePasswordForService:account:error:] in GTMOAuth2ViewControllerTouch.o
      -[GTMOAuth2Keychain setPassword:forService:accessibility:account:error:] in GTMOAuth2ViewControllerTouch.o
  "_kGTMOAuth2NetworkFound", referenced from:
      -[GTMOAuth2SignIn reachabilityTarget:changedFlags:] in GTMOAuth2SignIn.o
  "_kGTMOAuth2NetworkLost", referenced from:
      -[GTMOAuth2SignIn reachabilityTimerFired:] in GTMOAuth2SignIn.o
  "_kGTMOAuth2RefreshTokenChanged", referenced from:
      -[GTMOAuth2Authentication setKeysForResponseDictionary:] in GTMOAuth2Authentication.o
  "_kGTMOAuth2ServiceProviderGoogle", referenced from:
      +[GTMOAuth2SignIn standardGoogleAuthenticationForScope:clientID:clientSecret:] in GTMOAuth2SignIn.o
      -[GTMOAuth2SignIn auth:finishedWithFetcher:error:] in GTMOAuth2SignIn.o
      +[GTMOAuth2SignIn revokeTokenForGoogleAuthentication:] in GTMOAuth2SignIn.o
      +[GTMOAuth2ViewControllerTouch authForGoogleFromKeychainForName:clientID:clientSecret:] in GTMOAuth2ViewControllerTouch.o
      +[GTMOAuth2SignIn standardGoogleAuthenticationForScope:clientID:clientSecret:] in GTMOAuth2SignIn.o
      -[GTMOAuth2SignIn auth:finishedWithFetcher:error:] in GTMOAuth2SignIn.o
      +[GTMOAuth2SignIn revokeTokenForGoogleAuthentication:] in GTMOAuth2SignIn.o
      +[GTMOAuth2ViewControllerTouch authForGoogleFromKeychainForName:clientID:clientSecret:] in GTMOAuth2ViewControllerTouch.o
  "_kGTMOAuth2UserSignedIn", referenced from:
      -[GTMOAuth2SignIn handleCallbackReached] in GTMOAuth2SignIn.o
  "_kGTMOAuth2WebViewCancelled", referenced from:
      -[GTMOAuth2ViewControllerTouch viewWillDisappear:] in GTMOAuth2ViewControllerTouch.o
  "_kGTMOAuth2WebViewFailed", referenced from:
      -[GTMOAuth2ViewControllerTouch webView:didFailLoadWithError:] in GTMOAuth2ViewControllerTouch.o
  "_kGTMOAuth2WebViewFinished", referenced from:
      -[GTMOAuth2ViewControllerTouch webViewDidFinishLoad:] in GTMOAuth2ViewControllerTouch.o
  "_kGTMOAuth2WebViewKey", referenced from:
      -[GTMOAuth2ViewControllerTouch notifyWithName:webView:kind:] in GTMOAuth2ViewControllerTouch.o
  "_kGTMOAuth2WebViewStartedLoading", referenced from:
      -[GTMOAuth2ViewControllerTouch notifyWithName:webView:kind:] in GTMOAuth2ViewControllerTouch.o
      -[GTMOAuth2ViewControllerTouch webViewDidStartLoad:] in GTMOAuth2ViewControllerTouch.o
  "_kGTMOAuth2WebViewStopKindKey", referenced from:
      -[GTMOAuth2ViewControllerTouch notifyWithName:webView:kind:] in GTMOAuth2ViewControllerTouch.o
  "_kGTMOAuth2WebViewStoppedLoading", referenced from:
      -[GTMOAuth2ViewControllerTouch viewWillDisappear:] in GTMOAuth2ViewControllerTouch.o
      -[GTMOAuth2ViewControllerTouch webViewDidFinishLoad:] in GTMOAuth2ViewControllerTouch.o
      -[GTMOAuth2ViewControllerTouch webView:didFailLoadWithError:] in GTMOAuth2ViewControllerTouch.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)

3 个答案:

答案 0 :(得分:2)

我遇到了同样的问题。我的问题与Prefix.pch文件有关,我正在创建一个无限循环的导入。我改为删除了使用Google Drive API的数据源,并且只导入了使用它的特定文件。新手的错误,并且在屁股上很痛苦,但要确保你也没有无限循环!

答案 1 :(得分:0)

从文件中可以清楚地看出编译器没有读取/获取目标文件。如果您的类别文件已添加到应用程序目标,请检查目标。

这个问题我遇到了很多,希望这会解决你的问题。

答案 2 :(得分:0)

项目目标是使用但不链接到GTM OAuth 2控制器的来源编译的,http://code.google.com/p/gtm-oauth2/