Google/Analytics.h file not found when adding to AppDelegate

前端 未结 8 1560
迷失自我
迷失自我 2020-12-30 04:06

I am trying to integrate Google Analytics in my ios project using Cocoapods. However, after following this for the steps till adding configuration file to my project, when i

相关标签:
8条回答
  • 2020-12-30 05:03

    If anyone else out there is having an error with trying to #import <Google/Analytics.h>, and the other solutions online aren't helping you, you should read on.

    I was having this problem and none of the solutions I found would fix it. Then I noticed that one of my targets worked while the other one did not (I had two in the same project), and I tried to track down what was the difference between the two targets.

    I noticed that there was a difference in the project on the General tab under Deployment info, where the second target (the one which worked) had separate options for iPhone and iPad, but the first did not. Someone else online said that they received these two new options when they duplicated their target. My second target was also a duplicate of the first, originally.

    To make a long story short, I found that if I duplicated my target that the duplicate now suddenly worked. Those separate iPhone and iPad options also magically appeared. So I guess my project target was non-standard and causing a problem, probably because this project was created a long time ago.

    I then just deleted the original target and renamed the new one to be the same name, although there was some cleanup work required in the build settings related to the plist file (it made a copy.plist file).

    Hope this helps someone.

    0 讨论(0)
  • 2020-12-30 05:03

    Also my $0.02 to this, since it seems to be a never ending story. None of the suggestions above did help. I got this obscure message from pod install

    [!] The `blabla [Release]` target overrides the `HEADER_SEARCH_PATHS` build setting defined in `Pods/Target Support Files/Pods-blabla/Pods-blabla.release.xcconfig'. This can lead to problems with the CocoaPods installation
    

    Finally I inspected my project.pxbprojand found, that I had this entry:

    HEADER_SEARCH_PATHS = "";`
    

    Obviously this is treated as "defined", so I changed it to

    HEADER_SEARCH_PATHS = "$(inherited)";
    

    and boom - all the Google suggested includes work

    #import <GoogleAnalytics/GAI.h>
    #import <GoogleAnalytics/GAIDictionaryBuilder.h>
    #import <GoogleAnalytics/GAIFields.h>
    
    0 讨论(0)
提交回复
热议问题