How to handle merge conflicts in Xcode "pbxproj" file? - ios

Everytime I do a pull, there is a merge conflict from my other team member.. And I've tried to manually remove the ==== and >>>>'s but Xcode will never open the file after this.
I am just curious, is this a problem that EVERY iOS person on a team deals with? Is there any sort of tip or trick to avoid this nonsense? It's seriously slowing down my productivity by a huge amount.

You just need a good merge tool. I use p4merge: http://www.andymcintosh.com/?p=33 contains a guide to integrating it with Git.

these two can go a long way:
rely on the xcode project less, such that you could reconstruct a project by adding a directory of stuff, then get it to build with minimal changes. a good example of this: define your build settings in xcconfigs.
simplify your projects. collisions will be reduced if you are developing separate components of the same larger project.

I ran into a merge conflict that had to do with our team's cocoapods integration. After running pod deintegrate and then pod install again the .pbxproj file was parsable again.

Related

Xcode 10 build 10A255 requires clean build folder for all changes

After updating Xcode 10 from AppStore, when i add something even one single line, it doesn't apply change to build while i clean project. Is there any trick to prevent this or is it bug.
edit: i'm developing cocoapod, changes in Example app is applied to compile perfect but changes in development pod is require to clean to apply changes.
This is a known issue with the new build system of Xcode 10.
There are radars about this and cocoapods developers are aware of the issue.
In the meantime (because it is not gonna be fixed anytime soon), you can indeed switch to the legacy build system (or clean your build folder each time you want to recompile your example app).
Another option might be to disable cocoapods input/output paths, but it is not recommended.
Please note that switching the Compilation Mode build setting from Incremental to Whole Module will in fact not work as intended.
For more information about this you can check the following issues :
https://github.com/CocoaPods/CocoaPods/issues/7966
https://github.com/CocoaPods/CocoaPods/issues/8073

How to use development pods across our team?

When I set path for my development pod, I cant commit podfile - it will break pod install for other devs. So I keep podfile in another change list and its really annoying. Is there a better way to develop pod?
I found this: link, it suggest to change to path every time I want to update something in my pod. But it's even worth than uncommited podfile.
You can use relative paths for development pods.
You can ask your co-developers to always use the same folder hierarchy between your current project (with the podfile) and the others developments projects/pods (with the podspec).
You can also use Repo to automatically do it for you (could be useful when a new guy comes, and/or if you have plenty of different development pods). It will install different projects/(development)pods according to the hierarchy set in its manifest. You can check this related answer if needed.

iOS - update a framework

I built an app that uses a third party SDK. Recently I had to update the SDK with a new version. I removed the framework files from my application folder, copied the new ones, added them to the project, but it seems XCode is caching the old version.
I tried Clean, tried to delete Derived Data, nothing works. At this point it seems the only available option is to recreate the project and import all the source files. Obviously I am not keen on that. There must be an easy, fast solution to this issue.
Any clue?
Cocoa pods are easy to use and install.
CocoaPods is the dependency manager for Objective-C projects. It has
thousands of libraries and can help you scale your projects elegantly.
Ultimately, its goal is to improve discoverability of, and engagement
in, third party open-source libraries, by creating a more centralized
ecosystem.
However the frameworks need to be compatible with cocoa pods which most libraries are. You use terminal to install. This site may give you an idea how to install it.
Fixed it. I deleted all copies of the old SDK, whether or not they were in my project folder. Seems like XCode was linking to one of them... Another mystery.

Separate Xcode Project

We have 3 apps that we maintain, that all use the same menu controller and Core Data model. In addition, one of the apps uses several views and controllers from one of the apps. It's getting to the point that we need to find some way to separate into different projects to prevent painful Xcode project merges. Right now all the code is mixed in together and each app has its own target in one Xcode project.
Is there any way we can separate the project easily into different projects that have AppA, AppB, and AppC where AppB and AppC depend on AppA?
Depending on how each app is different, you can create different targets in your Xcode.
Here's a docs on how you create Xcode targets.
If that does not suit your need, you can create multiple projects and reference files from other projects. I really can't tell what you'd need without more information.
Maybe use cocoapods.
You can make your own (private) pods for the various files that your projects rely on and then keep them updated in their own repository, and then the projects can include the pod and update it when needed. You can also point specific projects to specific branches of the pod repo etc.
(Not sure whether Core Data is supported in pods yet though, might be)

Two related iOS apps in one CocoaPods workspace?

I am working together with some friends on a iOS project.
We are using CocoaPods for integrating third-party code (Facebook-iOS-SDK, ..) and sync the whole Xcode workspace (including the Pods Project) with Git and bitbucket.
Everything works perfect and we are very happy with this setup.
The only problem is, that we have to build a second application and the two apps will share a lot of common code.
Does it make sense to just add a second target to the workspace or is it better to create a private pod?
Other possibilities? We want't to keep things as simple as possible...

Resources