ios-branch-deep-linking-attribution icon indicating copy to clipboard operation
ios-branch-deep-linking-attribution copied to clipboard

Build errors when integrating Branch using SPM in Xcode 12.5b3 when Warnings are treated as Errors

Open gransell opened this issue 3 years ago • 24 comments

Hi

When building in Xcode 12.5b3 we get the following build errors because of missing .h files in Branch.h

Showing Recent Messages
/Users/gransell/Library/Developer/Xcode/DerivedData/QapitalApp-dmxntnlexxpmpzglcjqigbzxmirt/SourcePackages/checkouts/ios-branch-deep-linking-attribution/Branch-SDK/Branch.h:1906:1: Umbrella header for module 'Branch' does not include header 'BNCTuneUtility.h'
/Users/gransell/Library/Developer/Xcode/DerivedData/QapitalApp-dmxntnlexxpmpzglcjqigbzxmirt/SourcePackages/checkouts/ios-branch-deep-linking-attribution/Branch-SDK/Branch.h:1906:1: Umbrella header for module 'Branch' does not include header 'BNCKeyChain.h'
/Users/gransell/Library/Developer/Xcode/DerivedData/QapitalApp-dmxntnlexxpmpzglcjqigbzxmirt/SourcePackages/checkouts/ios-branch-deep-linking-attribution/Branch-SDK/Branch.h:1906:1: Umbrella header for module 'Branch' does not include header 'BNCTelephony.h'
/Users/gransell/Library/Developer/Xcode/DerivedData/QapitalApp-dmxntnlexxpmpzglcjqigbzxmirt/SourcePackages/checkouts/ios-branch-deep-linking-attribution/Branch-SDK/Branch.h:1906:1: Umbrella header for module 'Branch' does not include header 'BranchCPIDRequest.h'
/Users/gransell/Library/Developer/Xcode/DerivedData/QapitalApp-dmxntnlexxpmpzglcjqigbzxmirt/SourcePackages/checkouts/ios-branch-deep-linking-attribution/Branch-SDK/Branch.h:1906:1: Umbrella header for module 'Branch' does not include header 'BNCAppleReceipt.h'
/Users/gransell/Library/Developer/Xcode/DerivedData/QapitalApp-dmxntnlexxpmpzglcjqigbzxmirt/SourcePackages/checkouts/ios-branch-deep-linking-attribution/Branch-SDK/Branch.h:1906:1: Umbrella header for module 'Branch' does not include header 'BranchContentPathProperties.h'
/Users/gransell/Library/Developer/Xcode/DerivedData/QapitalApp-dmxntnlexxpmpzglcjqigbzxmirt/SourcePackages/checkouts/ios-branch-deep-linking-attribution/Branch-SDK/Branch.h:1906:1: Umbrella header for module 'Branch' does not include header 'BranchCreditHistoryRequest.h'
/Users/gransell/Library/Developer/Xcode/DerivedData/QapitalApp-dmxntnlexxpmpzglcjqigbzxmirt/SourcePackages/checkouts/ios-branch-deep-linking-attribution/Branch-SDK/Branch.h:1906:1: Umbrella header for module 'Branch' does not include header 'BNCSKAdNetwork.h'
/Users/gransell/Library/Developer/Xcode/DerivedData/QapitalApp-dmxntnlexxpmpzglcjqigbzxmirt/SourcePackages/checkouts/ios-branch-deep-linking-attribution/Branch-SDK/Branch.h:1906:1: Umbrella header for module 'Branch' does not include header 'BNCJSONUtility.h'
/Users/gransell/Library/Developer/Xcode/DerivedData/QapitalApp-dmxntnlexxpmpzglcjqigbzxmirt/SourcePackages/checkouts/ios-branch-deep-linking-attribution/Branch-SDK/Branch.h:1906:1: Umbrella header for module 'Branch' does not include header 'BNCAppleAdClient.h'
/Users/gransell/Library/Developer/Xcode/DerivedData/QapitalApp-dmxntnlexxpmpzglcjqigbzxmirt/SourcePackages/checkouts/ios-branch-deep-linking-attribution/Branch-SDK/Branch.h:1906:1: Umbrella header for module 'Branch' does not include header 'BNCAppGroupsData.h'
/Users/gransell/Library/Developer/Xcode/DerivedData/QapitalApp-dmxntnlexxpmpzglcjqigbzxmirt/SourcePackages/checkouts/ios-branch-deep-linking-attribution/Branch-SDK/Branch.h:1906:1: Umbrella header for module 'Branch' does not include header 'BNCFieldDefines.h'
/Users/gransell/Library/Developer/Xcode/DerivedData/QapitalApp-dmxntnlexxpmpzglcjqigbzxmirt/SourcePackages/checkouts/ios-branch-deep-linking-attribution/Branch-SDK/Branch.h:1906:1: Umbrella header for module 'Branch' does not include header 'BNCSpotlightService.h'
/Users/gransell/Library/Developer/Xcode/DerivedData/QapitalApp-dmxntnlexxpmpzglcjqigbzxmirt/SourcePackages/checkouts/ios-branch-deep-linking-attribution/Branch-SDK/Branch.h:1906:1: Umbrella header for module 'Branch' does not include header 'BranchRedeemRewardsRequest.h'
/Users/gransell/Library/Developer/Xcode/DerivedData/QapitalApp-dmxntnlexxpmpzglcjqigbzxmirt/SourcePackages/checkouts/ios-branch-deep-linking-attribution/Branch-SDK/Branch.h:1906:1: Umbrella header for module 'Branch' does not include header 'BNCCallbackMap.h'
/Users/gransell/Library/Developer/Xcode/DerivedData/QapitalApp-dmxntnlexxpmpzglcjqigbzxmirt/SourcePackages/checkouts/ios-branch-deep-linking-attribution/Branch-SDK/Branch.h:1906:1: Umbrella header for module 'Branch' does not include header 'BranchShortUrlSyncRequest.h'
/Users/gransell/Library/Developer/Xcode/DerivedData/QapitalApp-dmxntnlexxpmpzglcjqigbzxmirt/SourcePackages/checkouts/ios-branch-deep-linking-attribution/Branch-SDK/Branch.h:1906:1: Umbrella header for module 'Branch' does not include header 'BranchOpenRequest.h'
/Users/gransell/Library/Developer/Xcode/DerivedData/QapitalApp-dmxntnlexxpmpzglcjqigbzxmirt/SourcePackages/checkouts/ios-branch-deep-linking-attribution/Branch-SDK/Branch.h:1906:1: Umbrella header for module 'Branch' does not include header 'BranchShortUrlRequest.h'
/Users/gransell/Library/Developer/Xcode/DerivedData/QapitalApp-dmxntnlexxpmpzglcjqigbzxmirt/SourcePackages/checkouts/ios-branch-deep-linking-attribution/Branch-SDK/Branch.h:1906:1: Umbrella header for module 'Branch' does not include header 'BranchLogoutRequest.h'

gransell avatar Mar 11 '21 13:03 gransell

@gransell Were you able to get past this issue? I wasn't able to reproduce the issue.

echo-branch avatar Mar 23 '21 18:03 echo-branch

@echo-branch Thanks for looking into this. I just gave this another look with a clean test project importing only Branch and was not able to reproduce there. Could be something with our project. I'll keep investigating. I'll close this for now and report any findings here when we manage to fix it.

gransell avatar Mar 24 '21 06:03 gransell

@echo-branch

I revisited this now and turns out we got the errors because we had "Treat warnings as errors" turned on. We still get the warnings in a simple Xcode project that imports branch via SPM and just does a simple import Branch in a swift file.

Attaching a sample project with the issue. BranchTest.zip

gransell avatar Apr 19 '21 12:04 gransell

Ah yea, we have some clean up warnings tickets floating around for a while. We just haven't had the dev resources free up to fix them though.

echo-branch avatar Apr 19 '21 18:04 echo-branch

I'm getting this error too. A temporary fix was to also turn off "Treat warnings as errors".

adammcarter avatar Apr 21 '21 14:04 adammcarter

Yeah. That's the "fix" we have opted for as well.

gransell avatar Apr 22 '21 07:04 gransell

Hey Branch, is there any update on this? As you know, XCode 12.5 is officially out, and this is a blocker to upgrading to XCode 12.5 for many of us.

james-lukanta-ck avatar Apr 28 '21 21:04 james-lukanta-ck

It's in progress, however we've found some of the warnings are non-trivial to remove and may take some time to refactor away.

echo-branch avatar Apr 28 '21 22:04 echo-branch

Hi @echo-branch! Any updates on this?

nikolouzos avatar Jun 16 '21 10:06 nikolouzos

@nikolouzos The warnings should be fixed and merged into master, and will be in the next general release 1.40.0. We're still working on some testing of server signature changes on that version, so you should not try it yet.

echo-branch avatar Jun 21 '21 17:06 echo-branch

Any update on this? I'd love to get back to warnings-as-errors but can't because of this issue.

jsorge avatar Aug 23 '21 20:08 jsorge

@jsorge It's on track for the 1.40.0 release, however it did not make the 1.39.4 patch release.

echo-branch avatar Aug 23 '21 22:08 echo-branch

@echo-branch When will 1.40.0 land?

jsorge avatar Sep 17 '21 23:09 jsorge

I am still seeing this issue when using 1.40.2

rr-matthew-benjamin avatar Feb 04 '22 00:02 rr-matthew-benjamin

Hi, this issue is present on 1.40.1 too.

mdelamatata avatar Mar 15 '22 14:03 mdelamatata

Hi everyone, we are working on this and hope to get this out by the end of this month. We will update you all when the release is available.

jf-branch avatar Mar 15 '22 14:03 jf-branch

Hi, also ran into this on 1.42, would be very nice to resolve this

tottakai avatar Jun 08 '22 14:06 tottakai

It's quite annoying this issue, would be great if we can prioritise this and have it fixed in the new releases as it's been floating around for well over a year now

TheCoordinator avatar Sep 21 '22 09:09 TheCoordinator

@TheCoordinator We hear you. Unfortunately the fix is to rename our library, which has cascading impact on all our build, test and documentation. It will get done, but it wasn't a simple one sprint fix we originally thought and will need to be on a major version update.

echo-branch avatar Sep 21 '22 18:09 echo-branch

@echo-branch totally understandable. It would be good to understand, from your perspective, why certain fixes are not viable

  • Adding the missing headers to Branch.h (understand we don't want files that aren't used but this could be a short term solution)
  • Updating the modulemap file to exclude these headers explicitly (I don't see a modulemap for Branch-SDK) (example)

jhurray avatar Sep 21 '22 19:09 jhurray

@jhurray So the error message is a bit confusing. The actual issue is that the Branch.h header is both the umbrella header and the header for a class. This leads to Xcode getting confused and throwing a lot of warnings. The fix is to create a dedicated umbrella header BranchSDK.h and use Branch.h as a class header. Internally we've already done this, but the impact outside the SDK is extensive.

For historical note, we ended up here by doing a quick fix hack to convert our static library SDK to a framework. That hack was to treat the Branch.h as both a class header and umbrella header.

echo-branch avatar Sep 21 '22 19:09 echo-branch

Got it - I see how thats an issue & how it can leak downstream into documentation etc.. Thanks & good luck

Side note - any idea why we would see this only in Xcode 14 and not Xcode 13.4? I'm sure its an apple thing but found that curious

jhurray avatar Sep 21 '22 19:09 jhurray

@echo-branch FYI I found a decent workaround if you want to share this w/ folks:

  • Create a local swift package that wraps Branch (IMO always a good practice for 3rd party SDKs)
  • in the target definition add a compiler flag to suppress warnings

Main downside is your local package will not have warnings, up to the consumer if that tradeoff is worth it

            swiftSettings: [
                .unsafeFlags(["-suppress-warnings"])
            ]

Edit: This is not working when I clean, will follow up if / when I make progress

jhurray avatar Sep 22 '22 00:09 jhurray

@jhurray I like that strategy. It would be much nicer than globally disabling the warning.

echo-branch avatar Sep 22 '22 16:09 echo-branch

Any progress here?

pm-dev avatar Nov 11 '22 02:11 pm-dev

@pm-dev We have a branch that's currently undergoing testing. Since it's somewhat disruptive we've had to hold it for other feature work a couple times already. Currently we're planning on shipping it after we ship an update for SKAN 4.0.

echo-branch avatar Nov 14 '22 17:11 echo-branch