Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS application doesn't see public protocol from framework

I created Static Framework and added it to an iOS app. In Framework I created new public protocol:

public protocol ProtocolName
{
    func methodName1(arg1: Int)
}

I rebuilt framework, but I can't use this protocol in my app.

import FrameworkName

class ClassName: ProtocolName
{
    func methodName1(arg1: Int)
}

(Error in class definition: Use of undeclared type 'ProtocolName')

The app sees other protocols, other classes and views. It also sees changes in my framework (I added some test print and rebuild framework to check if the app uses the newly built version and it works).

File with the protocol is in Target Membership for the framework. I tried to remove the whole framework and link it again, close and reopen XCode, clean both project few times, but nothing works.

I tried also to add next protocol - also isn't recognized in the app (but other, older protocols are).

I checked framework definition in the app (right click on a module and Jump to Definition) - there are no mentions of the new protocol.

I guess something is wrong with the generation of the framework metadata (classes and method definitions), but I can't find a way to fix it.

Any help or ideas would be appreciated.

like image 372
franiis Avatar asked Mar 09 '23 21:03

franiis


1 Answers

OK, I think I can leave this question for someone with the same problem (maybe will save 3-4 hours).

The solution was quite simple: remove Derived Data for project and framework (maybe removing derived data for an app will be enough, but I removed both so I can't tell).

How to do it in XCode: https://stackoverflow.com/a/39495772/5226328

like image 51
franiis Avatar answered Apr 02 '23 03:04

franiis