Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Alamofire Crash #9

Open
hydraCy opened this issue Aug 12, 2024 · 9 comments
Open

Alamofire Crash #9

hydraCy opened this issue Aug 12, 2024 · 9 comments

Comments

@hydraCy
Copy link

hydraCy commented Aug 12, 2024

In my project, I use Swift Package Manager (SPM) to include Alamofire. Since Particle uses CocoaPods and also depends on Alamofire, when I call the auth.connect method, it causes a crash in Alamofire's public init(url: URLConvertible, method: HTTPMethod, headers: HTTPHeaders? = nil) method with the error Thread 7: EXC_BAD_ACCESS (code=1, address=0x20), due to method being unable to read data.

@SunZhiC
Copy link
Collaborator

SunZhiC commented Aug 12, 2024

  1. If you insist on using SPM to include Alamofire, you need to exclude Alamofire's integration in the Podfile to avoid duplicate integration of Alamofire.
post_install do |installer|
  installer.pods_project.targets.each do |target|
    if target.name == 'Alamofire'
      target.remove_from_project
    end
  end
end

2.Or remove Alamofire from SPM.

@hydraCy
Copy link
Author

hydraCy commented Aug 12, 2024

When I remove Alamofire, RxAlamofire encounters errors, and since Alamofire is also a dependency for other libraries in SPM, I cannot remove it.

@SunZhiC
Copy link
Collaborator

SunZhiC commented Aug 14, 2024

When I remove Alamofire, RxAlamofire encounters errors, and since Alamofire is also a dependency for other libraries in SPM, I cannot remove it.

Okey,you can try remove Alamofire in Podfile.

@hydraCy
Copy link
Author

hydraCy commented Aug 15, 2024

This is a very strange phenomenon. If I remove the dependencies of Particle, such as Alamofire and SwiftyJSON, Cocoapods will throw errors during compilation because it is not compatible with SPM. But why does calling certain methods from ParticleAuth cause it to reference libraries from SPM? I cannot remove the duplicate dependencies from Pods because it will cause compilation errors in Particle.

@SunZhiC
Copy link
Collaborator

SunZhiC commented Aug 15, 2024

This is a very strange phenomenon. If I remove the dependencies of Particle, such as Alamofire and SwiftyJSON, Cocoapods will throw errors during compilation because it is not compatible with SPM. But why does calling certain methods from ParticleAuth cause it to reference libraries from SPM? I cannot remove the duplicate dependencies from Pods because it will cause compilation errors in Particle.

Looks like above solution will not remove Alamofire from pod, so you have to add Particle SDK manually, you can get all the xcframeworks from the Demo project, then put the Particle SDKs that you need into your project.
Then add all the sub dependencies from SPM or Cocoapods.

@hydraCy
Copy link
Author

hydraCy commented Aug 16, 2024

This is a very strange phenomenon. If I remove the dependencies of Particle, such as Alamofire and SwiftyJSON, Cocoapods will throw errors during compilation because it is not compatible with SPM. But why does calling certain methods from ParticleAuth cause it to reference libraries from SPM? I cannot remove the duplicate dependencies from Pods because it will cause compilation errors in Particle.

Looks like above solution will not remove Alamofire from pod, so you have to add Particle SDK manually, you can get all the xcframeworks from the Demo project, then put the Particle SDKs that you need into your project. Then add all the sub dependencies from SPM or Cocoapods.

I tried to integrate using xcframeworks, but I encountered a problem. When I include the library with .package(url: "https://github.com/SunZhiC/Base58Swift", from: "1.0.0"), the xcframeworks use import Base58_swift instead of import Base58Swift, causing the xcframeworks to fail to compile.

@SunZhiC
Copy link
Collaborator

SunZhiC commented Aug 16, 2024

import Base58_swift is right

This is a very strange phenomenon. If I remove the dependencies of Particle, such as Alamofire and SwiftyJSON, Cocoapods will throw errors during compilation because it is not compatible with SPM. But why does calling certain methods from ParticleAuth cause it to reference libraries from SPM? I cannot remove the duplicate dependencies from Pods because it will cause compilation errors in Particle.

Looks like above solution will not remove Alamofire from pod, so you have to add Particle SDK manually, you can get all the xcframeworks from the Demo project, then put the Particle SDKs that you need into your project. Then add all the sub dependencies from SPM or Cocoapods.

I tried to integrate using xcframeworks, but I encountered a problem. When I include the library with .package(url: "https://github.com/SunZhiC/Base58Swift", from: "1.0.0"), the xcframeworks use import Base58_swift instead of import Base58Swift, causing the xcframeworks to fail to compile.

Try again, I had updated this package "https://github.com/SunZhiC/Base58Swift", import from SPM, should use import Base58_swift in file.

@hydraCy
Copy link
Author

hydraCy commented Aug 20, 2024

import Base58_swift is right

This is a very strange phenomenon. If I remove the dependencies of Particle, such as Alamofire and SwiftyJSON, Cocoapods will throw errors during compilation because it is not compatible with SPM. But why does calling certain methods from ParticleAuth cause it to reference libraries from SPM? I cannot remove the duplicate dependencies from Pods because it will cause compilation errors in Particle.

Looks like above solution will not remove Alamofire from pod, so you have to add Particle SDK manually, you can get all the xcframeworks from the Demo project, then put the Particle SDKs that you need into your project. Then add all the sub dependencies from SPM or Cocoapods.

I tried to integrate using xcframeworks, but I encountered a problem. When I include the library with .package(url: "https://github.com/SunZhiC/Base58Swift", from: "1.0.0"), the xcframeworks use import Base58_swift instead of import Base58Swift, causing the xcframeworks to fail to compile.

Try again, I had updated this package "https://github.com/SunZhiC/Base58Swift", import from SPM, should use import Base58_swift in file.

I have imported TweetNacl through https://github.com/bitmark-inc/tweetnacl-swiftwrap. Why is the system reporting 'Missing required module 'CTweetNacl''? Is the library I imported correct?

@SunZhiC
Copy link
Collaborator

SunZhiC commented Aug 21, 2024

import

Try import TweetNacl through cocoapods, I haven't tried import it from SPM.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants