26

I have seen a similar warning to that below for a pod-defined class when using #import syntax in cocoapod sources, but this is an internal apple class definition (CLSUserDefaults) which I have no control over and am not subclassing.

I don't know if this is really causing a problem, but it shouldn't be happening.

objc[22040]: Class CLSUserDefaults is implemented in both 
/System/Library/PrivateFrameworks/ClassKit.framework/Versions/A/ClassKit (0x7fff9932d2c0) and 

/Users/devusrid1/Library/Developer/Xcode/DerivedData/MyApp-cdokjmhxdrnhuodmhtibejxyqmqt/Build/Products/Debug/USR ID MyApp.app/Contents/MacOS/My App (0x10057f340). 

One of the two will be used. Which one is undefined.

I'm using Xcode 11

Anshu
  • 1,277
  • 2
  • 13
  • 28
Phill Apley
  • 923
  • 10
  • 16

3 Answers3

19

Fabirc (or Crashlytics, depending on which versions used) defines a class named CLSUserDefaults.

It seems that ClassKit in iOS 13 also defines a CLSUserDefaults class, which leads to a name collision.

It should be fine as long as your app's code not using class CLSUserDefaults directly.

Hvordan har du det
  • 3,605
  • 2
  • 25
  • 48
  • 2
    But will it be fine for Crashlytics, I suppose they need to update their code? – Gerald Eersteling Sep 26 '19 at 12:41
  • First time I see a real world class name collision... I have wondered if Apple would ever add a class whose name clashes with my class-prefixes – eharo2 Oct 14 '19 at 18:14
  • Crashlytics has multiple classes with the CLS prefix (CLSAttributes, CSLLogging, CSLReport, etc). This could come up again in the future if a new class in ClassKit is added with any of these names – eharo2 Oct 15 '19 at 17:07
  • 7
    This is causing my app to crash when ran on iOS 13, any solutions? – silly_cone Oct 16 '19 at 08:54
  • 2
    I am also running into the same issue and XCode will not start my app. I am on React Native version 59.9. XCode version 11.3 and IOS version 13.3. When I try to run the app through xocde this error comes up in the XCode console – Lucas Santos Jan 15 '20 at 17:47
  • I am also getting same issue. anyone find the solution? – Jignesh Kanani Jan 22 '20 at 13:11
3

If you are you using Crashlytics, update your Fabric and Crashlytics versions in your Podfile as:

pod 'Fabric’, '~> 1.10.2’
pod 'Crashlytics’, '~> 3.14’

And then

pod install

Sudheer Kumar Palchuri
  • 2,919
  • 1
  • 28
  • 38
1

In my case same error showed (Just in iOS 13), but used another way to solve this:

  1. I removed Fabric and Crashlytics from project (with uses in app)
  2. Then error message changed! (There was two errors: One for RemoteNotification and one for using statusBar in AppDelegate)
  3. I solved first using this: https://stackoverflow.com/a/45440917/5853262
  4. Then solved second with commenting this line in AppDelegate: UIApplication.statusBarBackgroundColor = navigationBarColor
  5. Then I reverted code to before doing step 1 using git(Before Removing Fabric and Crashlytics)
  6. Then I fixed errors that not shown (Doing step 3 and 4)
  7. After Clean and Build, the app launched successfully.

Notice: In your case maybe another error causes this problem, but when Fabric and Crashlytics exist, Xcode doesn't shows them. as I did, remove them, fix errors, then rollback changes and just fix bugs that you know. This would be work.

Mahdi Moqadasi
  • 2,029
  • 4
  • 26
  • 52