Once installed you can use Xcode to manage which version of the language, debugger, and compiler you are running with just a few clicks. For this example let’s install the Swift 3.0 development trunk in Xcode 7.3.1 which is the latest release version as of this post. I’m inherently optimistic. A new version of the app is available? Install it straight away! And this generally works well, I’m aware of the updates and new features and don’t get left behind. Except when it doesn’t. I’d updated to the latest version of Xcode (11.4) and updated Visual Studio for Mac and the corresponding Xamarin.iOS, and let’s just say it did not go well: This.

-->
  1. As an iOS developer, you often have to coordinate and use a specific versions of Xcode as part of a team. Especially if the codebase gets older, bigger and more complex.
  2. Update: Our readers pointed out that Xcode 4.3 simplifies this process considerably by bundling Xcode into a single application. Therefore, this guide is most relevant to older versions. XCode 4.3 and later versions should be able to uninstall like any other Mac app, whereas older versions of XCode require the manual process outlined below.

Xamarin documentation assumes use of the latest Xamarin.iOS and Xcode, which is recommended. However, some customers would prefer to use older Xamarin.iOS and/or Xcode, and would like details on the consequences.

The release notes contain the following warning:

Warning

Using an older Xcode version

Using an older Xcode version (than the one mentioned in the above requirements) is often possible, but some features may not be available. Also some limitations might require workarounds, e.g.:

  • The static registrar requires Xcode headers files to build applications, leading to MT0091 or MT4109 errors if APIs are missing. In most cases enabling the managed linker will help (by removing the API).
  • Bitcode builds (for tvOS and watchOS) can fail submission to the App Store unless an Xcode 9.0+ toolchain is used.

Further information

Microsoft strongly recommends using the latest Xcode and most recent Xamarin.iOS release when developing and submitting applications. Apple requires using the most recent Xcode when submitting applications.

Xcode Install Older Macos Sdk

Note that using the latest Xcode does not prevent your application from targeting older iOS versions. The iOS versions you support is based upon your Info.plist entry and the APIs your application uses.

It is possible to install multiple versions of Xcode side-by-side, with different names such as Xcode101.app and Xcode102.app. If you use multiple versions, make sure to set the active Xcode in Visual Studio for Mac Settings and with the xcode-selectcommand line tool.

However, rare circumstances may require use of older components. This documentation will describe the general challenges you may face when using versions older than latest.

Each release from Apple is unique though, and you may come across other pitfalls not documented here.

These challenges are sometimes non-trivial to solve, so whenever possible stick to the supported configuration of latest Xcode and latest Xamarin.iOS.

Use of an old Xamarin.iOS with an old Xcode

Not updating Xamarin.iOS and Xcode is possible, at least for some amount of time. The limit is that, at some point, Apple will require a minimum version of Xcode to submit your applications. At this point you should update all your components (macOS, Xcode and Xamarin.iOS) to the latest versions (or the new, minimal version of Xcode required by Apple and the matching Xamarin.iOS release).

It’s generally easier to gradually update and keep up with the small changes. For large projects where updates can be harder to keep up with, staying with known working set can be a good compromise.

Use of new Xamarin.iOS with older Xcode

Xamarin.iOS in general supports older Xcode releases whenever reasonably possible. A few potential challenges include:

  • The newer Xamarin.iOS may support some features and APIs not present in the selected Xcode.
  • The static registrar requires Xcode headers files to build applications, leading to MT0091 or MT4109 errors if APIs are missing.
    • In most cases enabling the managed linker will help (by removing the managed bindings for the new API) if unused.
  • Bitcode builds (for tvOS and watchOS) can fail submission to the App Store unless an Xcode 9.0+ toolchain is used.

Use of new Xcode with older Xamarin.iOS

This use case is significantly more difficult, as Xamarin.iOS can not predict the changing requirements of new Xcode. Updates of macOS can also introduce problems, and without compatibility patches many parts of Xamarin.iOS could be affected.

There are a number of potential areas where things can go wrong including:

  • Incompatibilities with mlaunch:
    • Simulator support might not work properly (or at all)
    • Device support might not work properly (or at all)
  • Unknown support for mtouch
    • No support for new frameworks
    • No support for new entitlements
    • No support for new or updated tools
      • This can affect code signing as well

New AppStore submission rules

Older

Apple reserves the right to updates to the AppStore submissions rules at any time. These rule changes are only sometimes announced in advance. Some of these changes require tooling changes to support, which would require an updated Xamarin.iOS component.

In addition to the rule changes, Apple often adds additional validations to submitted apps or tightens existing ones. Some of these require changes in our tools (e.g. a new blocklisted symbols). Many of these are first encountered by customers submitting, as there is no announcement (or list) of the rules.

Install older xcode download

Summary

Whenever possible, play it safe by following Apple’s guidance and developing on and submitting with the latest Xcode released on the App Store.

In turn, use the latest Xamarin.iOS released. This will track the latest fixes that may affect submitted applications and comply with the most recent rule changes.

Where that is not feasible, consider using a matched older Xcode and Xamarin.iOS release. This can work for a time, but at some point Apple will insist upon newer tooling so plan accordingly.

In this post I will show how to Install Cocoa Pods for Xcode projects. Cocoa Pods is a dependency manager for Swift and Objective-C Cocoa projects.

Installation

When you install XCode, you also get the gem (RubyGems, the Ruby package manager). This command allows you to install Cocoa Pods for Xcode, without any extra configuration. Execute the following command

sudo gem install cocoapods

Install Older Xcode Software

After fetching a list of dependency packages, you can use cocoa pods calling the command pod. However, each command must be executed in theroot folderof your Xcode project:

  • pod init: To create an empty initial PodFile in your Xcode project folder.
  • pod install: To install packages defined in the PodFile

Using Cocoa Pods command line

Create your Xcode application as usual. Then, after you install Cocoa Pods, you can create the initial PodFile executing pod initinside the root folder of your application. After that, you will get aPodFile like this:

If you want to add some pod, like the Google Maps iOS SDK components, you can add it to the section target:

Then, you can install the pods defined in the PodFile using the command pod install.

The first time you run pod install, the system will retrieve the master repository of Cocoa Pods. This will retrieve a local reference of all Cocoa pods available. It could take a couple of minutes to complete.

Then, you will receive a message of a successful installation of pods:

To avoid the warning message about the platform version, you may want to edit the Podfile. Uncomment the platform definition or creating a new one. Generally, use the last available platform, unless the project or the component has some platform version restrictions:

platform :ios, '12.0'

Your Podfile contents will lok like this one

Using Cocoa Pods Components in Xcode

Open the Xcode project workspace

Running the command pod install will create a new Xcode workspace to manage your project. From now, you need to open your project from the .xcworkspace (Example: ios-googlemaps-view.xcworkspace).

Open the .xcworkspace file from Finder or call open your-project-name.xcworkspace from command line. If you open the .xcodeproj file, you will not be able to compile your project with cocoa pods references.

Xcode Project structure

Now your workspace contains 2 projects, your Application itself, and the Pods project. The second one is to manage your pods, to compile and link with your project.

Add a Custom Cocoa component

Adding a custom component is simple.

  • Start adding an UIView to your application view.
  • Configure the contraints and position
  • Configure a custom Class name (Example: GMSMapView)
Attach your component to the code

Follow this steps to attach your component to the code as an @IBOutletand complete the imports:

  • Open an assistant editor(double circle button) along with the storyboard side-by-side
  • Right click over the component and drag to the ViewController code window
  • Assign a variable name(example: mapView)
  • Add import for GoogleMaps library
  • Additionally, modify AppDelegate to configure API keys for Google Maps and Google Places API if needed.

From this point, you will be able to work in your application as usual.

Originally Posted in https://developerhowto.com/2018/11/06/cocoa-pods-for-xcode/