Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to update a framework in an iOS app?

Tags:

ios

frameworks

I'm writing an app using Nuance's SpeechKit framework. I've just downloaded a newer version of the framework that contains new methods in some of the classes. To upgrade, I deleted the framework and the re-added the new one. When I right-click on the framework in Xcode and click "reveal in finder", it shows the new framework. When I open up the "Headers" subfolder of the framework in Xcode, I see the new methods.

The problem is that my class seems to still be referencing the header file in the old location, as the new methods are not visible within my application.

How do I upgrade a framework properly? Is there somewhere else in Xcode that contains a path reference to the SDK?

like image 911
MusiGenesis Avatar asked Jul 07 '11 18:07

MusiGenesis


2 Answers

You need to delete Derived Data for the project - it is an option of the project in the XCode Organizer, on the projects tab. It will remove the cached build of the framework, forcing XCode to use the new one.

  1. Choose Window/Organizer from the top menu
  2. Click "Projects" pseudo-tab-thing, along the top of organizer window (icon looks like an XCode project file"
  3. Select the project from the list on the left
  4. Click "Delete" next to "Derived Data" in the area immediately below the project info header.
  5. List item

EDIT: as of XCode 12 (should work with Xcode 8 and above), you can delete derived data like this:

Go to File > Workspace Settings if you are in a workspace environment or File > Project Settings for a regular project environment.

Then click over the little grey arrow under Derived data section and select your project folder to delete it in Finder.

like image 200
RyanR Avatar answered Nov 02 '22 11:11

RyanR


I found what cause this issue for us.

When you build a new version you must update "Current Library Version". There is also a "Compatibility Version"

In Xcode selector your framework target and in build settings search for linking and you will se this setting there.

We created a build script to bump this version number every time we build.

Xcode caches the frameworks and uses the cache if possible. That's why you need to change this number.

like image 40
Mikael Bartlett Avatar answered Nov 02 '22 10:11

Mikael Bartlett