How To Create Symlink For Sublime Text and Visual Studio Code in a Mac

This tip is for creating symlink for your favorite text editor, it is like an alias but more powerful. This would allow you to launch the application from the command line. ( You can do the same by setting paths as an alternative to symlinks). Symlinks can only be created from the terminal.

First find out the bin executable directory for the application. Then for the location where the symlink is to be created – /usr/local/bin/

The following command allows you to create symlink for Sublime Text

sudo ln -s "/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl" /usr/local/bin/subl

Then to launch it from the terminal simply type : subl

The following command allows you to create symlink for Visual Studio Code

sudo ln -s "Applications/Visual Studio Code.app/Contents/Resources/app/bin/code" /usr/local/bin/code

Then to launch it from the terminal simply type : code

Fix Swift Framework Error: Module compiled with Swift 5.1.3 cannot be imported by the Swift 5.2.4 compiler:

Chances are you upgraded to the latest Xcode and along with it, your Swift compiler is updated as well. Then existing projects using a particular project have stopped working with similar error such as.

Module compiled with Swift 5.1.3 cannot be imported by the Swift 5.2.4 compiler:

/Users/PauloOrquilo/Documents/Development/Mobile/Training/CoreData/Sync/iOSDemo/Carthage/Build/iOS/Sync.framework/Modules/Sync.swiftmodule/x86_64.swiftmodule

Or you are checking out some hosted on code on Github using some framework, the framework might have been built using an older compiler version, if you try to run the associated .xcodeproj or .xworkspace it won’t build the project.

This is only for frameworks built using Carthage. I haven’t experienced this on CocoaPods. Make sure you have Carthage installed – check this documentation on how to install Carthage – https://github.com/Carthage/Carthage

To fix, take a backup of your project, or better yet make sure you are using version control. Delete the framework that is failing from your project.

Go to the Project directory from the Terminal and make sure the Cartfile is available and run. Choose the right platform for the app.

carthage update --platform IOS

It should create a newly .framework on the Carthage/Build folder.

On Xcode go the General Tab and under Framework, Libraries and Embedded Content. Drag and drop the files

Then finally, try running the build and your project should be working.

Hope you find this tip useful.

Troubleshooting pod install Error on CocoaPods

Going through the Getting Started guide for Firebase I encountered this error ‘JSON::ParserError – 767: unexpected token at ‘ and thought to blog and share how to fix it.

I went to the Xcode project directory in the terminal and ran

pod init

Then I defined the PodFile spec

# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'

target 'Firebase Getting Started' do
  # Comment the next line if you don't want to use dynamic frameworks
  #use_frameworks!

  # Pods for Firebase Getting Started
  pod 'Firebase/Analytics'
  # Add the pods for any other Firebase products you want to use in your app
  # For example, to use Firebase Authentication and Cloud Firestore
  pod 'Firebase/Auth'
  pod 'Firebase/Firestore'

end

But when I ran

pod install

I encountered this error

[!] Oh no, an error occurred.

Search for existing GitHub issues similar to yours:
https://github.com/CocoaPods/CocoaPods/search?q=767%3A+unexpected+token+at+%27%27&type=Issues

If none exists, create a ticket, with the template displayed above, on:
https://github.com/CocoaPods/CocoaPods/issues/new

Be sure to first read the contributing guide for details on how to properly submit a ticket:
https://github.com/CocoaPods/CocoaPods/blob/master/CONTRIBUTING.md

Don't forget to anonymize any private data!

Looking for related issues on cocoapods/cocoapods...
 - [1.9.2] Error during pod install JSON::ParserError - 767: unexpected token
   https://github.com/CocoaPods/CocoaPods/issues/9814 [open] [31 comments]
   8 hours ago

 - https://github.com/CocoaPods/CocoaPods/search?q=767%3A+unexpected+token+at+%27%27&type=Issues
   https://github.com/CocoaPods/CocoaPods/issues/9777 [closed] [3 comments]
   2 weeks ago

 - Error during pod install: Encountered an unknown error (783: unexpected token at
   https://github.com/CocoaPods/CocoaPods/issues/9672 [closed] [92 comments]
   22 hours ago

and 12 more at:
https://github.com/cocoapods/cocoapods/search?q=767%3A%20unexpected%20token%20at%20%27%27&type=Issues&utf8=?

[!] Automatically assigning platform `iOS` with version `13.5` on target `Firebase Getting Started` because no platform was specified. Please specify a platform for this target in your Podfile. See `https://guides.cocoapods.org/syntax/podfile.html#platform`.

After checking the issues. It turns out the cocoapods repo cache on my machine somehow got corrupted. To fix the error I simply deleted the cache.

sudo rm -rf ~/.cocoapods/repos

And running pod install after that worked.