at-internet / atinternet-apple-sdk

AT Internet mobile analytics solution for Apple devices
http://www.atinternet.com
MIT License
25 stars 47 forks source link

'Tracker/Crash.h' file not found #29

Closed mackoj closed 6 years ago

mackoj commented 6 years ago

I have this 'Tracker/Crash.h' file not found when I tried to compile your SDK with Cocoapods SDK version ATInternet-Apple-SDK/Tracker (2.8.9).

I'm trying Cocoapods 1.5.0 because it can improve significantly app start time https://twitter.com/alloy/status/972503674009288705.

Dans le fichier TrackerTests-Bridging-Header.h

Remplacer

#import <Tracker/Crash.h>
#import <Tracker/Hash.h>

Par

#import "Crash.h"
#import "Hash.h"
d-theo commented 6 years ago

Oh that's great news from Cocoapods. Do you use ATInternet-Apple-SDK/Tracker ? I believed that static framework were not available for frameworks that contain assets

mackoj commented 6 years ago

I do use ATInternet-Apple-SDK/Tracker. Great point I didn't know that but It doesn't seem to block Cocoapods I think we(as you from ATInternet and us user) should test this more.

In order to improve our startup time, we are trying to move every dependency into a lot of static libraries and then build around one dynamic library.

This is the explanation of our journey if you are interested if not we research how to do it without a lot of success until Cocoapods propose this feature.

We started by watching this WWDC video session and read this article.

We want to achieve something like Automatic or Artsy/Eigen did.

In order to passe all of our dependency into static dependency, we tried Amimono, Accelerator and Swift-Staticlibs but it wasn't a great success.

When Cocoapod announce that they will support swift static framework it's was a great news for us.

The first part of this support came back in 1.4.0 and a second part will come into 1.5.0.

Thanks for your time and work

d-theo commented 6 years ago

I pushed a test branch where i'm going to see how it goes :) pod 'ATInternet-Apple-SDK/Tracker', :git => 'https://github.com/at-internet/atinternet-apple-sdk', :branch => 'static_lib'

mackoj commented 6 years ago

Sorry for the delay I was on vacation. I have this issues now.

<unknown>:0: error: module map file '/Pods/Headers/Public/Tracker/ATInternet-Apple-SDK.modulemap' not found
<unknown>:0: error: module map file '/Pods/Headers/Public/Tracker/ATInternet-Apple-SDK.modulemap' not found
<unknown>:0: error: missing required module 'SwiftShims'
mackoj commented 6 years ago

I still have this issue with the last version of Cocoapods and the last version of this SDK 2.8.9 and Cocoapods(1.5.2) Please test your SDK with use_frameworks!(false) in your Podfile.

Thanks,

d-theo commented 6 years ago

I am currently working on the branch 2.9beta, but I'm facing strange bugs with cocoapods

edit: the CoreData stack seems to fail to initialize with the static library flag in my podspec. I guess it has to do with the fact that assets are not well supported

d-theo commented 6 years ago

I finally managed to make it works with static library on a fresh project ! If you have time, can you try the branch 2.9 and tell me if it works for you too ?

target 'YourApp' do
  use_frameworks!(false)
  pod "ATInternet-Apple-SDK/Tracker", :git => "https://github.com/at-internet/atinternet-apple-sdk.git", :branch => "2.9beta"
end

I may need more tests to check ObjC compatibility and if nothing with core data was broken in the process for older apps but the official update should be next week

mackoj commented 6 years ago

Ok I will try thanks !

d-theo commented 6 years ago

I have some trouble pushing the new spec (in master) with the static flag... I think it's a CP bug, possibly related to this one : https://github.com/CocoaPods/CocoaPods/issues/7617

d-theo commented 6 years ago

update : after (too much) hours of failure, I'm not able to push the SDK with the static feature. Its seems that CP 1.5.3 to not stable enough

mackoj commented 6 years ago

Ok I understand will you try again when Cocoapods 1.6.0 is out ?

d-theo commented 6 years ago

I will keep an eye on it 👍 If you really need the feature, you can still go with the static_lib branch or the commit 26697cc81bd227c9ad9798a68c460a67f8bd0ada

Unless we have some GDPR issues or hotfixes, chances are that the tracker is not going to be updated before swift5 ;)

fabb commented 6 years ago

Cool, we'd also be interested in using this lib as a static framework.

Could it be that the podspec needs to be modified in order for #import "TrackerTests-Bridging-Header.h" not be included in the umbrella header that Cocoapods generates?

My umbrella header (from the master branch) looks like this:

#ifdef __OBJC__
#import <UIKit/UIKit.h>
#else
#ifndef FOUNDATION_EXPORT
#if defined(__cplusplus)
#define FOUNDATION_EXPORT extern "C"
#else
#define FOUNDATION_EXPORT extern
#endif
#endif
#endif

#import "Crash.h"
#import "Hash.h"
#import "Tracker.h"
#import "TrackerExtension.h"
#import "TrackerTests-Bridging-Header.h"

FOUNDATION_EXPORT double TrackerVersionNumber;
FOUNDATION_EXPORT const unsigned char TrackerVersionString[];

There's really no need for TrackerTests-Bridging-Header.h in client projects I guess.

fabb commented 6 years ago

Maybe you just need to declare the public_header_files in you podspec to fix the issue?

d-theo commented 6 years ago

Hello, the main issue was related to s.resources and importing all the .png in there. I changed it by including all the pngs into a bundle and cocoapods seems to be ok again. Good news after this change, pod spec lint finally worked with the static flag 👍

Right now i'm working on something else that should go live soon so I don't have many bandwidth to work on it (i'm just the maintainer btw) but be sure that it's going to work soonish :)

fabb commented 6 years ago

@d-theo I looked at the static_lib branch. It is not necessary that you set s.static_framework = true. Cocoapods 1.5.0 will automatically integrate all frameworks statically if the use_frameworks! statement is removed from the client Podfile. When setting static_framework = true, the pod will always be built static, even if use_frameworks! is specified. You might still decide to keep the static_framework setting, but I wanted to point out the difference.

fabb commented 6 years ago

@d-theo And another thing that I saw in the diff: when you add TrackerTests-Bridging-Header.h to the exclude_files of the Tracker subspec, then it is not necessary to change the imports in TrackerTests-Bridging-Header.h. I guess the test header shouldn't be part of the public interface of the pod anyways?

d-theo commented 6 years ago

Yeah I guess so :)

d-theo commented 6 years ago

hi guys,

I finally pushed a version (2.9.4) without TrackerTests-Bridging-Header.h (and some small fixes) and it looks like it's working perfectly 👍 I kept the static_framework = true and will see if there are limitations.

From what I understand it could help people that still needs to keep use_frameworks! for some reason. With the static_framework = true they would still get the compilation boost from the libs that support static builds.

Also we changed our git process from Private Development, Public Releases and we will work only on this repo in hope to make easier the CI process ;)

mackoj commented 6 years ago

thanks