grpc / grpc-ios

gRPC for iOS
Apache License 2.0
39 stars 22 forks source link

Swift Package Manager won't resolve grpc due to unsafe flags #86

Closed RandomActsOfCode closed 2 years ago

RandomActsOfCode commented 2 years ago

Problem Description

Version 1.44.1-grpc contains unsafeFlags in the Package.swift manifest which prevents clients from using grpc. Unsafe flags can only be used for local packages and not for public packages. From the docs:

As some build flags can be exploited for unsupported or malicious behavior, the use of unsafe flags makes the products containing this target ineligible for use by other packages.

Error Produced

The error produced is:

image

Workaround

Unfortunately, this is a transitive dependency in our project and we are not specifying the version. To workaround this we can pin the version to the tag before this change was introduced:

 dependencies: [
    .package(
      url: "https://github.com/grpc/grpc-ios",
      .exact("1.44.0-grpc")
    ),

This is cumbersome since we don't directly use grpc and will have to remember to take this out when the issue is resolved. A warning is also generated since the pinned package is not directly used:

image
dennycd commented 2 years ago

@RandomActsOfCode. this issue should now be resolved. Please reset your local cache and try again (1.44.1-grpc) . thanks

sumanc commented 2 years ago

It is working now. But I had to delete the Derived Data and restart the XCode to make it work.