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.-->
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:
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.:
MT4109errors if APIs are missing. In most cases enabling the managed linker will help (by removing the API).
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.
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.
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.
Xamarin.iOS in general supports older Xcode releases whenever reasonably possible. A few potential challenges include:
MT4109errors if APIs are missing.
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:
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.
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.
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
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
PodFilein your Xcode project folder.
pod install: To install packages defined in the
Create your Xcode application as usual. Then, after you install Cocoa Pods, you can create the initial
pod initinside the root folder of your application. After that, you will get a
PodFile like this:
If you want to add some pod, like the Google Maps iOS SDK components, you can add it to the section
Then, you can install the pods defined in the PodFile using the command
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'
Podfile contents will lok like this one
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:
.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.
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.
Adding a custom component is simple.
UIViewto your application view.
Follow this steps to attach your component to the code as an
@IBOutletand complete the imports:
AppDelegateto 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/