美文网首页
xcode15报错

xcode15报错

作者: _菩提本无树_ | 来源:发表于2024-03-10 17:39 被阅读0次

更新到Xcode15,适配之前的代码,记录当前遇到的问题和解决方法。

1.WebKit错误

error: type argument 'nw_proxy_config_t' (aka 'struct nw_proxy_config *') is neither an Objective-C object nor a block type
@property (nullable, nonatomic, copy) NSArray<nw_proxy_config_t> *proxyConfigurations NS_REFINED_FOR_SWIFT API_AVAILABLE(macos(14.0), ios(17.0));
                                              ^~~~~~~~~~~~~~~~~
1 error generated.
WebViewJavascriptBridge/WebViewJavascriptBridge/WKWebViewJavascriptBridge.h:16:9: fatal error: could not build module 'WebKit'
#import <WebKit/WebKit.h>

这里主要要搜索“nw_proxy_config_t”关键字,建议不要用百度搜索,有点坑,用谷歌或者必应进行搜索。
解决方法1:
1.选中不能编译的库的xcodeproj,在Build Phrases -> Compile Sources,选中所有文件,逐一在Complier Flags 里删除 -DOS_OBJECT_USE_OBJC=0。
如图:

image

解决方法2:
⭐️⭐️⭐️如果上面的方法不能解决报错,请用下面的方法进行修改:

1.访达前往:/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS17.0.sdk/System/Library/Frameworks/WebKit.framework/Headers 
2. 拷贝一份“WKWebsiteDataStore.h”文件到自己的桌面
3.将WKWebsiteDataStore.h文件中的 将里面的 170000 修改成 180000。
4.将桌面上修改的 WKWebsiteDataStore.h 文件拷贝到  Headers 文件下面进行替换老的WKWebsiteDataStore.h文件
5.再次运行demo 

image

2.缺失 libarclite_iphoneos.a

报错:

找不到文件:/Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/arc/libarclite_iphoneos.a

解决方法:
因为需要指定版本到有特殊要求,可以考虑从其他版本的Xcode拷贝
使用访达,文件前往:

/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/

在这个路径下新建一个 usr 文件夹,放入链接下载的文件,即可。
文件链接:https://gitee.com/TikBai_admin/Libarclite-Files.git

image

3. duplicate symbols && Assertion failed

报错信息:

ld: 1 duplicate symbols
clang: error: linker command failed with exit code 1 (use -v to see invocation)

或者:

Assertion failed: (false && "compact unwind compressed function offset doesn't fit in 24 bits"), function operator(), file Layout.cpp, line 5758. 

解决方法:
在other link flags添加 -ld64
Build Settings -> Linking - General -> Other Link Flags 添加-ld64 或者 -ld_classic

如图:

image

4.打包报错Command PhaseScriptExecution failed with a nonzero exit code

解决方法:
找到Pods-xxxx-frameworks.sh文件,替换代码:

#    source="$(readlink "${source}")"
     source="$(readlink -f "${source}")"

如图所示:

image

5.打包报错腾讯IM:Asset validation failed

报错信息:

/Frameworks/TUIGroup.framework' is missing plist key.The
Info.plist file is missing the required key:CFBundleShortVersionString.Please find more
information about CFBundleShortVersionString at https://developer.apple.com/
documentation/bundleresources/information_property_list/cfbundleshortversionstring(ID:
0627ef87-66c9-428b-b36b-69178374702c

如图所示:

image

解决方法:
通过添加腾讯IM相关的技术人员解决

image
在 podfile 最后一个 end 后面,添加下这个看看

#Pods config
#Fix Xcode14 Bundle target error
post_install do |installer|
    installer.pods_project.targets.each do |target|
        target.build_configurations.each do |config|            
            config.build_settings['GENERATE_INFOPLIST_FILE'] = "NO"
        end
    end
end

参考链接:
iOS17适配Xcode15问题
Xcode版本升级build报错问题
集成腾讯IMSDK后打包上架报错

作者:柠檬不争
链接:https://www.jianshu.com/p/cab0fee0cc78
来源:简书
著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。

相关文章

网友评论

      本文标题:xcode15报错

      本文链接:https://www.haomeiwen.com/subject/kkupzdtx.html