Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Runtime warning CLSUserDefaults is implemented twice

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

like image 553
Phill Apley Avatar asked Jul 10 '19 16:07

Phill Apley


3 Answers

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.

like image 69
LET'S DISMANTLE NATO Avatar answered Nov 15 '22 06:11

LET'S DISMANTLE NATO


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

like image 29
Sudheer Kumar Palchuri Avatar answered Nov 15 '22 06:11

Sudheer Kumar Palchuri


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.

like image 39
Mahdi Moqadasi Avatar answered Nov 15 '22 06:11

Mahdi Moqadasi