【Xcode 26.4】报错netinet6/in6.h和comparison ‘X < Y < Z‘

背景:

Xcode 26.4 原生工程运行报错

问题1:

Use of private header from outside its module: 'netinet6/in6.h'

原因:直接导入 netinet6/in6.h 在新版 Xcode 中是不允许的。最佳实践是使用标准的 netinet/in.h 和 arpa/inet.h 来替代,这些头文件提供了相同的 IPv6 功能,且是公开的、受支持的 API。

目前以下三方库都涉及:

临时解决方案:删掉,等第三方优化再更新吧。

记得右上角解锁再删,不影响debug。pod后会覆盖,需要再删除,或者脚本一下也可以。


问题2:

*****/YYText/Component/YYTextLayout.m:1508:69 Chained comparison 'X < Y < Z' does not behave the same as a mathematical expression

原因:运算符不支持,扩写

以前:

if (5 < 10 < 20) {

// This would actually be: (5 < 10) < 20 → 1 < 20 → true

// But it won't work correctly for all cases

}

修改为:

if (5 < 10 && 10 < 20) {

// This correctly evaluates to true

}

临时解决方案:

YYTextLayout:

bash 复制代码
    [self _insideComposedCharacterSequences:line position:position block: ^(CGFloat left, CGFloat right, NSUInteger prev, NSUInteger next) {
        if (isVertical) {
            position = fabs(left - point.y) < fabs(right - point.y)&&fabs(right - point.y) < (right ? prev : next);
        } else {
            position = fabs(left - point.x) < fabs(right - point.x) &&fabs(right - point.x) < (right ? prev : next);
        }
    }];
    
    [self _insideEmoji:line position:position block: ^(CGFloat left, CGFloat right, NSUInteger prev, NSUInteger next) {
        if (isVertical) {
            position = fabs(left - point.y) < fabs(right - point.y)&&fabs(right - point.y) < (right ? prev : next);
        } else {
            position = fabs(left - point.x) < fabs(right - point.x)&&fabs(right - point.x) < (right ? prev : next);
        }
    }];

最后,注意是临时方案!!后面等第三方兼容。

相关推荐
k4m7v2pz12 小时前
用中文编程语言写游戏:玄铁语言生命游戏的 macOS 适配实录
游戏·macos·玄铁·生命游戏·中文编程语言·玄铁中文编程
大熊猫侯佩1 天前
macOS27 上可变界面尺寸 iOS App 揭秘
macos·ios·swiftui
tangzzzfan1 天前
把 ADB 装进 macOS app
macos
大熊猫侯佩1 天前
iPhone Duo 从外屏到内屏:ArrangementView 抢先适配
swiftui·xcode·apple
大熊猫侯佩1 天前
为 iPhone Duo 做准备:containerConcentric 自适配指南
前端·swiftui·xcode
黑化旺仔8 天前
【OC】KVO
macos·ios·objective-c·cocoa
捷瑞电子工坊9 天前
嵌入式蓝桥杯从零点亮第一个LED
stm32·蓝桥杯·cubemx·嵌入式·led·ll·锁存
Liekkas Kono9 天前
macOS 27 安装 VMware Fusion 和 Win11 经验
macos·win11·vmware
shark-chili11 天前
关于AI辅助编程的认知
数据库·人工智能·redis·macos·缓存