Friday, October 13, 2023
HomeiOS Developmentios - Xcode error "'xxx.h' file not discovered" when importing headers from...

ios – Xcode error “‘xxx.h’ file not discovered” when importing headers from pod dependency in a framework


To make sure that any venture relying on it may possibly use it, a category in an iOS framework should inherit from a category in its pod dependency. To attain this, the header of the category must be made public. Nevertheless, after doing so, Xcode generates an error stating that it can not discover the header file for the pod dependency when trying to import headers.

I labored on an Xcode venture referred to as ‘HelloTargetWithPod’ that included a framework referred to as ‘Hey’. In my Podfile, I added the AFNetworking library as a dependency for the “Hey” goal, utilizing the next code:

platform :ios, '14.0'

goal 'Hey' do
  use_frameworks!
  pod 'AFNetworking', '~> 4.0.1'
finish

goal 'HelloTargetWithPod' do
  use_frameworks!
finish

After working pod set up and shutting “HelloTargetWithPod.xcodeproj”, I opened “HelloTargetWithPod.xcworkspace”.

Throughout the “Hey” framework, I created a public class referred to as “MyImageDownloader” and imported the AFNetworking header file utilizing the next code in “MyImageDownloader.h”:

#import "AFNetworking/AFNetworking.h"

@interface MyImageDownloader : NSObject

// ...

@finish

Nevertheless, once I tried to compile the venture, Xcode generated the error “‘AFNetworking/AFNetworking.h’ file not discovered”.

Within the meantime, there are two extra points:

  1. If MyImageDownloader.h will not be set as public, the error doesn’t happen.

  2. Importing <AFNetworking/AFNetworking.h> in MyImageDownloader.m doesn’t generate an error. Why does it generate an error in MyImageDownloader.h?

  3. If MyImageDownloader.h is about as public and add the next code:

    @class AFImageDownloader;
    
    NS_ASSUME_NONNULL_BEGIN
    
    @interface MyImageDownloader : AFImageDownloader
    
    @finish
    
    NS_ASSUME_NONNULL_END
    

    Xcode shows the error message “Trying to make use of the ahead class ‘AFImageDownloader’ as superclass of ‘MyImageDownloader'”.

I’ve uploaded the related venture code to this Git repository.

This challenge is much like the [Including a pod inside a framework target: file not found](Together with a pod inside a framework goal: file not discovered). I’ve tried the options offered, however they didn’t work.

I am unsure how one can resolve this challenge, and I would respect any assist or recommendation.



Supply hyperlink

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments