63

I recently integrated Google Cloud Messaging into an app targeting iOS 7 and iOS 8. Just grabbed Xcode 7 beta 4 to get started on iOS 9 support, and now I'm getting an error from the linker:

ld: warning: object file (.../Pods/GoogleInterchangeUtilities/Libraries
/libProtocolBuffers.a(Descriptor.pb.o)) was built for newer iOS version (8.3)
than being linked (7.0)

and a handful more like that all for parts of libProtocolBuffers.a.

Does this mean that iOS 8.3 is required to use the GCM library? If so, why did Xcode 6 happily spit out code that (by all appearances in my testing with iOS 7 devices) delivered push notifications to iOS 7.3 without issue?

Given that they're just warnings, I can still compile fine, however I prefer not to ship code that is wrong.

Edit: I emailed google and they said top people will look into it. In the mean time, if you're reading this and bothered by the warning, maybe also email so they'll be encouraged to deal with it.

buildsucceeded
  • 4,203
  • 4
  • 34
  • 72
Jony Thrive
  • 931
  • 1
  • 7
  • 15

6 Answers6

42

It actually means that the Minimum Deployment Target of the included library was is to 8.3 and linking it with lower Minimum Deployment Target produces this warning.

Library does not officially support targets lower than 8.3 in this case. While linking this library to target with ower Minimum Deployment Target will still work, it might produce crashes at runtime, if any 8.3 only code is executed on a device that runs older system than 8.3.

There is a reason why developers set 8.3 as the minimum target and this warning should NOT be ignored. It might be harmless in this case, but it is not necessarily harmless in other cases!

To fix these warnings, either use an older version of the library or set your Minimum deployment target to 8.3.

Legoless
  • 10,942
  • 7
  • 48
  • 68
  • 1
    The version of GCM that causes this issue is said by Google to support iOS7 or greater. Perhaps the lib throwing the warning is not actually used by GCM? why the inclusion then... I wish it was just open source – Jony Thrive Oct 14 '15 at 16:15
37

This just means that one of the libraries(Protocol Buffers here) GCM depends on was built for 8.3 although it's compatible with the min sdk version of GCM i.e. 7.0. XCode 7 is just more severe and reports it as a warning but it was always there just not being reported by previous versions.

Overall this is just harmless, everything should work fine. Also there is not much that you can do unless Google patches GCM by building all of it's dependencies with the min sdk version (7.0).

evanescent
  • 1,373
  • 13
  • 20
  • 2
    If it works regardless of the version it was built for, what's the point of the linker's warning? – Jony Thrive Aug 06 '15 at 22:17
  • Well it is a valid warning because if you're building a library you can make this mistake inadvertently and not realize it unless one day something starts breaking all of a sudden. XCode is just letting the developer know that he should most probably build one of his dependencies against the min supported SDK. – evanescent Aug 07 '15 at 17:36
  • @evanescent so how can I build the pod against correct SDK? It is impossible to select other than 9.0 – kas-kad Aug 25 '15 at 19:30
  • 1
    @purrrminator You should still be able to use the Pod. There's nothing you can do since the Pod was built in such a way. Unless Google comes up with a new pod version which fixes this we would have to live with the warning. – evanescent Aug 26 '15 at 23:08
  • This answer is entirely wrong! The warning means that the Minimum SDK version for the library is 8.3, so it DOES NOT support iOS 7.0. Xcode 9 does not exist, and Xcode 7 does not alert this. This means that the library supports iOS 8.3 and newer and will probably not work correctly on iOS 8.0, 8.1 and 8.2. It might not crash, but there might be a reason Google chose 8.3 as the Minimum target! – Legoless Oct 05 '15 at 13:52
  • 4
    The warning is harmless only in GCM's context since I've confirmed with the Google folks that the library is actually backwards compatible till iOS 7.0. It was just built with the wrong `min_ios_version` and Google has confirmed that they will fix the warning in the next release. – evanescent Oct 05 '15 at 18:07
  • How to suppress this warning in Xcode since it's harmless? – Itachi Sep 08 '17 at 06:36
28

My way to fix:

  1. Check "Deployment Target" is equal to Podfile "Platform"
  2. Delete DerivedData (/Users/yourUser/Library/Developer/Xcode)
  3. Pod install (Terminal)
  4. Clean/Build Project

P.s. Can add more info if needed.

OMGHaveFun
  • 838
  • 1
  • 10
  • 16
6

In targets/Build Settings/Linking/Other Linker Flags ,add

-w

silence the warning for me.

wj2061
  • 6,778
  • 3
  • 36
  • 62
4

FYI, the latest version of the relevant pods seems to have fixed this issue.

Specifically, it looks like it was the upgrade of GoogleInterchangeUtilities from 1.0.0 to 1.1.0 that did the trick.

If you're seeing this, a "pod update" should make it all better!

Codiak
  • 1,832
  • 2
  • 13
  • 20
1

In my case the reason was that I just updated pods then changed deployment target to lower then it was before and got such warnings. Running pod update again solves the issue.

Injectios
  • 2,777
  • 1
  • 30
  • 50