升级了xcode16后,geos报错
WKBWriter::writeCoordinate(const CoordinateSequence& cs, size_t idx, bool is3d) 这个方法报错了,Out-of-line definition of 'writeCoordinate' does not match any declaration in 'geos::io::WKBWriter'
void writeCoordinate(const geom::CoordinateSequence& cs, size_t idx, bool is3d); Unknown type name 'size_t'
在xcode15上没有问题,升级了16就报错了,请问是哪里出了问题
Hi, could you please provide a sample project that we can use to repro this issue?
您好,麻烦您使用xcode新建个项目,使用pod安装这两个库platform :ios, '15.6' #source 'https://github.com/CocoaPods/Specs.git' source 'https://mirrors.tuna.tsinghua.edu.cn/git/CocoaPods/Specs.git'
target "exm" do use_frameworks! pod 'GEOSwift' pod 'Turf'
#pod 'geos', :modular_headers => true
end 然后把这个地址下的swift文件放入项目中,并创建桥接文件即可复现 https://github.com/gbx1994/demo-for-issue-geoswift.git 这个文件在xcode15中并不会产生错误,在xcode16中就会有很多错误
@gbx1994 I just tried this out, but the project builds fine for me with Xcode 16.2. I did have to make some changes to the demo file (adding GEOSwift. to some types so that the compiler didn't think they were supposed to be Turf types; changed the global lets to vars and assigned initial values).
@gbx1994 which versions of GEOSwift, geos, and Turf are you using?
Also which version of CocoaPods?
您好,我使用的CocoaPods版本是1.16.2, 您上边提到的对文件做了一些修改,添加GEOSwift.一些类型,以便编译器不认为它们应该是 Turf 类型;将全局lets 更改为vars 并分配初始值) 请问这是如何操作的,您方便提供一个您修改的图片吗?
pod 'GEOSwift', '~> 11.0.0' Turf是1.0版本
Looking a bit more closely at the screenshot you shared above, I think that the issue is that in the header, your system is not seeing size_t in WKBWriter.h. This is causing it to fail to see the method declaration corresponding to the definition in WKBWriter.cpp.
So I think we need to figure out why size_t isn't being resolved correctly in WKBWriter.h.
I found a simpler way to fix the build issues I saw in the demo file:
typealias LineString = GEOSwift.LineString
typealias Geometry = GEOSwift.Geometry
typealias Polygon = GEOSwift.Polygon
var ne = CLLocationCoordinate2D()
var sw = CLLocationCoordinate2D()
And then add a force-try in calculatTopologicallyEquivalent(coordinates:) on this line:
let polyon1 = try! polygon.makeValid()
Can you share your c++ related build settings on the geos framework target?
What about on the geos framework target (in the pods xcode project)?
create a bridge file
Do you mean a bridging header? If so, what do you put in your bridging header for the demo?
您好 我尝试使用您上述的解决方式,强制给他们添加了类型,但还是会有问题
@gbx1994 thanks for the screenshots. There's a good chance that the typealiases won't work in your full project. Are you able to repro in a demo project using the steps you shared above?
Here's the demo project I put together trying to follow your steps: GEOSwiftIssue292.zip
Does it build for you?
是的,麻烦您看看是否可以下载并复现我所提出的问题
I can't repro using the project I shared. If you can, then I suspect there's some issue with your Xcode installation. You might want to try deleting & reinstalling Xcode.
您尝试使用object-c的项目, 添加Calculates.swift文件并为他们创建桥接文件
Still no luck…
It's getting late here, so I need to sign off. I'll check back in a day or two.
@gbx1994 I'm going to close out this issue assuming its been resolved. Let me know if we need to reopen it.