iOS Swift Troubleshooting: Cannot Load Underlying Module For

alamofire import error

Symptom

You see an awesome cocoapod you want to include in your project. So you add a code to your podfile telling it to import the cocoapod, you run “pod install” on your terminal to begin the import process, and voila, the cocoapod now inserted to your project. But when you add the namespace “import framework” on top of your Swift file, Xcode said “Cannot Load Underlying Module For <Framework>”.

Solution

The easiest explanation is that because you just import the cocoapod, it still hasn’t been built yet, while the other cocoapods in your project have. Therefore, Xcode sometimes overlooks that there is one or two cocoapods that are new.

  1. Optional: If there’s any, comment out any “import <framework>” statement
    In this abnormal state, this statement may gets processed first before Xcode process whether there are any unbuilt pods or not.
  2. Optional: Clean up the build folder.
    This will force Xcode to rebuild everything from scratch, and not playing favorite.
  3. Optional: Completely quit Xcode, and reopen it, then reopen the project again.
    Sometimes the issue is that the Xcode editor can’t let go of the mistakes in the past.
  4. Rebuild the project.
  5. Optional: Uncomment all the “import <framework>” earlier.
  6. Run the project.

So actually the solution to this is just do rebuild first, not run. The optional steps are there if you have run the solution without the optional steps and it’s still not working. For me, I had to clean build folder and close the Xcode, but I didn’t have to comment out the “import <framework” statement. But some people did have to.

Sources / Read More

Advertisements

Bookmarks: How to Solve “Could Not Set Up iCloud Keychain” Issue

icloud-keychain-logo

Link: https://discussions.apple.com/thread/6985097

Apple was (is) notoriously eager to introduce yet another security layer for the iCloud. Yesterday, I was forced to change my iCloud password, which resulted in some login problem with all of my emails and built in social media accounts on my Mac, even though I have entered the correct password. So with the help of my friend, I decided to log my Mac out the iCloud, and then login back again. The log out process itself was a little bit complex in its own way, but finally I’m able to log out. Then I restart my Mac. After that, I log in my Mac again to the iCloud. The system then tried to activate iCloud features one by one. At the iCloud keychain section, iCloud sent an sms to a number that’s associated with my iCloud, which was a deactivated number. Crap. Trying to change the number itself gave me error “failed to change phone number”. I then tried to find some article to change that number, which I find it here: link.

  1. On your iphone – Setting > iCloud > Keychain
  2. Approve with security code on the passcode step.
  3. Click ‘forgot code’ and then click ‘reset’.
  4. Follow on screen step, you will be able to update your phone number.

After that, I was able to receive the sms with password number to input to my Mac. Voila, my Mac’s iCloud was setup successfully!

Wait, what’s that notification just showing on my iPhone?

My iPhone asked me to re-login into iCloud keychain. Apparently, now it’s my iPhone turn to be logged out (forcefully) from iCloud. What? But thank God I’ve change the number. So the process is quite similar, but now it’s my Mac approving my iPhone instead. But then I got the error “could not set up icloud keychain”.

What the heck, Apple? So now my iPhone got locked out of iCloud keychain? After several attempts to reactivate the keychain, I was going to give up, but some search then enlighten me into this forum support, which gave information that this issue happened because Apple was issued a 4 digits security code to the iCloud, and later upgrade it into 6 digits. My iCloud code was the 4 digits version. That’s why the authentication kept failing. The question is why right now? Why not before, when the security code was upgraded to 6 digits? But anyway, these are the steps to fix this:

  1. Go to your other device (iPad, iPhone or Mac) and go to iCloud.
    In my case, my Mac has already connected to iCloud. I don’t know what will happen if it hasn’t.
  2. Then go to keychain.
    This keychain is not on the website of the iCloud, but on the system settings of your device.
  3. Then go to advanced.
  4. Then change security code.
  5. Change it with the new six digits system.
  6. Go back to that device you need to signing it to the keychain. And type the same new six digits then you’ll be signed in.

And that’s it. I hope this will helps you too like it helps me. Meanwhile, let’s hope Apple will revise its security so that it’s more streamlined.