225

iOS 10 / Xcode 8 GM build getting the below, never had it before on Xcode 7. Any ideas?

objc[25161]: Class PLBuildVersion is implemented in both /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/System/Library/PrivateFrameworks/AssetsLibraryServices.framework/AssetsLibraryServices (0x12049a910) and /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/System/Library/PrivateFrameworks/PhotoLibraryServices.framework/PhotoLibraryServices (0x1202c4210). One of the two will be used. Which one is undefined.

(NOTE: Only seems to happen in simulator, does not appear on real device).

Roman Ermolov
  • 7,750
  • 5
  • 24
  • 34
FlatDog
  • 2,526
  • 2
  • 12
  • 18

7 Answers7

145

Main Idea

Main idea is simple:

If your app (or dependencies, such as Pods) uses framework, that uses explicit (or implicit) PhotoLibraryServices.framework or AssetsLibraryServices.framework as dependency, Xcode warns you (even if you are using only one of them). It might be Photos/PhotosUI.framework or AssetsLibrary.framework, or another (I don't have full list of dependencies, but it is possible).

What is the problem?

Class with name PLBuildVersion is defined in both PhotoLibraryServices.framework and AssetsLibraryServices.framework. Class name is unique in Objective-C (you can't define 2 classes with same name), so it is undefined which one will be used in runtime.

However, I think that it will not be a problem, because both classes have same methods and fields (checked this with disassembler) and I guess that both were compiled from the same source.

Radar is already sent.

Community
  • 1
  • 1
Roman Ermolov
  • 7,750
  • 5
  • 24
  • 34
  • @Kevin not yet. – Roman Ermolov Oct 17 '16 at 11:12
  • 2
    the warning message are still there. – Faiz Fareed Nov 07 '16 at 19:40
  • 9
    I found that if I use Webview in one VC, I got this type of warning message in debug window when the VC is shown. I use Xcode 8.1, swift 3. – David.Chu.ca Nov 09 '16 at 22:19
  • Just got this issue with Xcode 8.1, was working yesterday before update :/ – David Nov 17 '16 at 00:09
  • So is that a bug about linker? – Itachi Nov 22 '16 at 03:29
  • Still an issue in Xcode 8.2. Only when the webview is used. – Andr3s4n Jan 03 '17 at 13:46
  • 1
    i m using xcode 8.2 and i have no any photolibary use in my project and i still get this warning. – Himanshu Moradiya Mar 17 '17 at 04:39
  • 1
    Is it me only or the viewcontroller presentation becomes slow, which is being presented and has this warning message??? – nr5 May 10 '17 at 14:52
  • 1
    I'm getting this message when setting a TextLabel.attributedText = try! NSAttributedString(data: stringToBeConverted.data(using: String.Encoding.unicode, allowLossyConversion: true)!, options: [ NSDocumentTypeDocumentAttribute: NSHTMLTextDocumentType], documentAttributes: nil). I don't have any Photolibrary. And the view controller presentation becomes slow. – Jeremias Serafim May 14 '17 at 23:15
  • 2
    I am also getting this warning when I set `.attributedText`. I am not accessing camera or photos. This warning also causes serious lag for the View Controller to load, even though there are no time intensive tasks involved (no network access, no file i/o, etc.). – R Moyer Jun 22 '17 at 15:58
53

As per answer from Apple employee on Apple's Developer Forum:

You don't control either of the class sources listed, so there isn't anything you can or should do – aside from Reporting a Bug.

Raphael Oliveira
  • 7,419
  • 4
  • 43
  • 53
46

I was unable to find a way to get rid of the warning, but if you want to prevent the app from crashing, you need to provide a description for why you are accessing the camera, photo library, etc. This is new in iOS10.

Input the following into your Info.plist file.

Photo

Key: Privacy - Photo Library Usage Description Value: $(PRODUCT_NAME) photo use

Camera

Key: Privacy - Camera Usage Description Value: $(PRODUCT_NAME) camera use

More info can be found here: https://iosdevcenters.blogspot.com/2016/09/infoplist-privacy-settings-in-ios-10.html

Nick Meehan
  • 703
  • 5
  • 6
12

I find you can get this error merely by using a UIWebView. My solution was to replace my use of UIWebView with WKWebView.

matt
  • 447,615
  • 74
  • 748
  • 977
5

I had this after adding Answers on Fabric to my project.

Deleting derived data did the trick for me. (shift alt command k in XCode)

Edit a year later:

After deleting derived data, always exit XCode and start it again.

In unrelated cases I have the impression that deleting derived data does not clear XCode’s in memory caches of the derived data.

Gerd Castan
  • 5,141
  • 3
  • 35
  • 70
2

Resetting the iOS simulator fixed this for me. Simulator -> Reset Content And Settings.

Eric Mentele
  • 754
  • 8
  • 15
0

In my case this warning started to appear after opening a second xcode project and running the second app on the simulator. After changing back to the first app, the warning started to appear. I just quit the Simulator and Xcode and reopened my project. The warning disappeared after that. If that doesn't solve it, proceed with the other answers. Xcode can be really picky sometimes.

Alexander Luna
  • 4,517
  • 4
  • 26
  • 34