iovation / deviceprint-SDK-iOS

iovation device print SDK for iOS
Other
34 stars 13 forks source link

Built framework fails to compile if adding/removing simulator from Architectures #10

Closed zackdotcomputer closed 4 years ago

zackdotcomputer commented 4 years ago

As of the latest Xcode (11.4), the framework is no longer rebuilding properly after adding or removing the simulator from the list of targeted architectures.

To reproduce: build an app with the FraudForce framework linked per instructions for either the simulator or for distribution. Then change the target so that the simulator is added or removed from the target architectures. Trying to rebuild again (even after a clean) will fail with the message "Building for iOS Simulator, but the linked and embedded framework 'FraudForce.framework' was built for iOS." (Or vice-versa if you are moving from simulator to distribution.)

This appears to be new behavior as of 11.4, as it is not presenting for coworkers who have not yet updated. The workaround for now is to delete the contents of the Frameworks-build folder, which will correctly cause the framework to be rebuilt with the proper architectures.

spsaucier-bakkt commented 4 years ago

Thanks for providing your workaround. I'm experiencing this as well.

error: Building for iOS, but the linked and embedded framework 'FraudForce.framework' was built for iOS Simulator. (in target 'MyApp' from project 'MyApp')
mark-sanvitale-iovation commented 4 years ago

Are the specifics of your situation that: the only thing that changed between it working and not working is updating/upgrading Xcode? Because I am wondering if you also upgraded macOS (perhaps from 10.14 to 10.15) and are encountering a modified version of this

PR 7: Use PlistBuddy instead of defaults in scripts

That specific issue has been fixed in v5.0.4 of the FraudForce SDK for iOS. If you cannot upgrade to v5.0.4 (or perhaps you updated the framework but did not copy the new build scripts?) then it is entirely permissible to take the v5.0.4 version of the build scripts and add them to your dev environment while continuing to use v5.0.3 of the SDK.

https://github.com/iovation/deviceprint-SDK-iOS/tree/master/FraudForce_SDK/build_scripts

It is also entirely within reason for the latest Xcode to have broken/modified things in a new way.

zackdotcomputer commented 4 years ago

@mark-sanvitale-iovation Thanks for the response. I was on 10.15 before, though I did update from 10.15.3 to 10.15.4 the same day I updated to the new XCode. I had just been acting under the assumption that a build issue would be XCode related rather than OS related! My bad, I should remember Apple can mess up my builds in almost infinite ways 😉

I had tried updating to 5.0.4 but the .zip file on your releases page didn't include the build_scripts folder, so I'd assumed they hadn't changed. I'll update to the latest build script and try again.

zackdotcomputer commented 4 years ago

Ah sorry, didn't mean to close the issue until I'd actually confirmed that it was fixed.

I pulled the latest build scripts (both of them) into my install. It didn't fix the issue - still seeing it when switching the target architecture from a Simulator (iPhone 11 Pro, in my case), running a build, and then switching the architecture to "Generic iOS Device" and building again (or vice-versa).

This is on XCode 11.4, Mac OS X 10.15.4, on a 13" 2019 Macbook Pro (though gosh I hope it's not hardware related, but might as well include it in the list).

mark-sanvitale-iovation commented 4 years ago

Thank you for the additional details. Our team has looked into this further, and it is a general issue introduced by Xcode 11.4. Xcode 11.3 and earlier do not exhibit this problem. The Xcode 11.4 Release Notes do not mention this as an issue or concern, but other 3rd party developers have documented their encounters with this problem:

My preferred solution is to use Xcode 11.3, but that is not always possible nor preferred by the larger iOS dev community. We will update the scripts and/or instructions for the FraudForce SDK in the near future, once this unexpected and undocumented (and in my opinion) regression in Xcode can be squeezed into our existing schedule of work.

zackdotcomputer commented 4 years ago

Thanks for investigating @mark-sanvitale-iovation. I agree with your comments in the dev forums and hope Apple can fix this regression or provide a clear workaround for it. Until then, I'll carry on rm -rf'ing the framework as needed.

allezoup commented 4 years ago

Do you have any news on this subject. I think a lot of your customers are impacted included us and the downgrade to Xcode 11.3 is clearly not an option. In the meantime we are deleting the generated framework each time we switch architecture but it's painful for our team.

sara-porter-iovation commented 4 years ago

I've been running a variety of different build settings through the 11.4 & 11.4.1 and it looks to be an issue with the New Build System (I've filed a Feedback bug) - Xcode 11.4 is now trying to validate Architectures before running the build scripts and failing if it finds an already built item with the wrong Architecture. If anyone finds the flag that's checking Architectures before building, let me know!

To help get around that I have come up with a couple of options:

mark-sanvitale-iovation commented 4 years ago

The "cleanup script" approach (second bullet point in the Apr 24 comment) has been added to the sample projects (both Objective-C and Swift) as part of the v5.1.0 release. This new build phase has also been added to the Readme, step 7 of the "Installation" instructions.