V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
iOS 开发实用技术导航
NSHipster 中文版
http://nshipster.cn/
cocos2d 开源 2D 游戏引擎
http://www.cocos2d-iphone.org/
CocoaPods
http://cocoapods.org/
Google Analytics for Mobile 统计解决方案
http://code.google.com/mobile/analytics/
WWDC
https://developer.apple.com/wwdc/
Design Guides and Resources
https://developer.apple.com/design/
Transcripts of WWDC sessions
http://asciiwwdc.com
Cocoa with Love
http://cocoawithlove.com/
Cocoa Dev Central
http://cocoadevcentral.com/
NSHipster
http://nshipster.com/
Style Guides
Google Objective-C Style Guide
NYTimes Objective-C Style Guide
Useful Tools and Services
Charles Web Debugging Proxy
Smore
Windy418
V2EX  ›  iDev

为什么通过 xcode 的 SPM 加载不出 github 上的库?

  •  
  •   Windy418 · Feb 11, 2025 · 2997 views
    This topic created in 445 days ago, the information mentioned may be changed or developed.
    通过 xcode 的 File -> Add Package Dependencies
    接着在右上角贴上 github 的地址,比如猫神的这个: https://github.com/onevcat/Kingfisher.git
    然后一直转菊花,要转很久,最后显示 Found 0 results
    这是什么原因?

    还有个就是,为什么我 remove 了包依赖,但是在左侧目录树上的最下方,还是会出现一些包依赖,根本删不干净

    xcode 是 16.2 ,系统是 Sequoia15.3

    我记得之前添加都是很顺利的,而且导入地址后,包很快就会出现,不知道为什么现在这么慢,而且加载不出包导致我无法进行后续的开发了
    15 replies    2025-02-12 11:30:52 +08:00
    rrubick
        1
    rrubick  
       Feb 11, 2025
    加代理啊
    Windy418
        2
    Windy418  
    OP
       Feb 11, 2025
    @magic3584 加了代理,也没用
    Mephisto233
        3
    Mephisto233  
       Feb 11, 2025
    终端代理没什么用,你要用代理的 tun 模式,让代理软件接管 Xcode 的流量
    PinkStarrySky
        4
    PinkStarrySky  
       Feb 11, 2025   ❤️ 1
    clash 的增强模式有用.终端代理没用.
    SayHelloHi
        5
    SayHelloHi  
       Feb 11, 2025
    1. 使用代理
    2. 打开代理的增强模式

    实在不行 只能全局了
    ethusdt
        6
    ethusdt  
       Feb 11, 2025
    Xcode 对这一块搞的真是一坨💩,自己手动 git pull 下来拖到 Xcode 当个本地的 package 吧。
    KunQAQ
        7
    KunQAQ  
       Feb 11, 2025
    xcode 等 github 账号用 SSH ,
    地址用 [email protected]/onevcat/Kingfisher.git
    okakuyang
        8
    okakuyang  
       Feb 11, 2025
    代理开增强模式,或者在在终端里设置代理,再输入命令 open xcode ,或者使用 proxifier 。
    RayJiang9
        9
    RayJiang9  
       Feb 11, 2025
    我的建议是别直接用 Xcode 自带的依赖管理,自己在项目里面建一个空的 SPM 项目。
    主工程 File -> Add Package Dependencies -> Add Local 把这个项目加进来,后续在空的 SPM 里面管理依赖。
    在空的 SPM 里把 Kingfisher 加进去
    终端代理,然后把 Xcode 关了,cd 到项目路径执行
    xcodebuild -resolvePackageDependencies -scmProvider system
    t4here
        10
    t4here  
       Feb 11, 2025
    spm 怎么整个跟 packge.json libs.version.toml 这样的配置文件?
    MrKrabs
        11
    MrKrabs  
       Feb 11, 2025
    ~/.gitconfig


    [http]
    proxy = socks5h://127.0.0.1:250
    qxmqh
        12
    qxmqh  
       Feb 11, 2025
    手动拉下来吧,或者直接开启增强模式代理,另外如果是多人开发,我建议你们别搞代理了,就弄下来当本地包。不然以后恶心自己 也恶心别人。
    CodingIran
        13
    CodingIran  
       Feb 11, 2025
    spm 是使用 git 拉取 remote 仓库,从没遇到过问题,你平时用 terminal git 拉取代码正常吗?本质上一样的
    CodingIran
        14
    CodingIran  
       Feb 11, 2025
    目前我项目内所有的依赖都使用的 smp ,无论 Kingfisher 这样的公仓还是公司内网的私仓都一切正常
    不确定是你的网络问题还是遇到什么 bug ,可以尝试定位问题:
    1.在终端内 git clone Kingfisher 项目是否正常
    2.尝试清空 spm 缓存:
    rm -rf ~/Library/Caches/org.swift.swiftpm
    rm -rf ~/Library/org.swift.swiftpm
    Windy418
        15
    Windy418  
    OP
       Feb 12, 2025
    @SimleCp 重新装了 ClashX ,开了增强模式,果然很快就出数据了。之前用的代理服务商自研的软件,貌似没有增强模式。
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   823 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 48ms · UTC 19:45 · PVG 03:45 · LAX 12:45 · JFK 15:45
    ♥ Do have faith in what you're doing.