我有 60k 行 pascal 代码(不要问:-))。使用free pascal为armv7和aarch64编译了dylib。它可以在设备上运行,但在以下情况下无法将其上传到应用商店
Invalid Swift Support - The SwiftSupport folder is missing. Rebuild your app using the current public (GM) version of Xcode and resubmit it.
这意味着
Dynamic libraries outside of a framework bundle, which typically have the file extension .dylib, are not supported on iOS, watchOS, or tvOS, except for the system Swift libraries provided by Xcode (tn2435).
所以,根据这个,应该有一种方法可以用dylib创建一个框架。此外,还有很多带有库的框架:Fabric、Crashlytics、Firebase、GoogleAnalytics 等。
我研究了这个框架并创建了自己的框架。但现在我有错误
The binary file 'test.dylib' is not permitted. Your app can’t contain standalone executables or libraries, other than the CFBundleExecutable of supported bundles.
所以,我的问题是如何使用 dylib 创建一个框架(使用 Function test(foo:integer):integer;cdecl;),加载它并在 ObjectiveC 项目中使用?
谢谢。
<小时/>使用 free pascal 编译了适用于 armv7 和 aarch64 的 dylib。 dlopen() 运行良好,但无法上传到应用商店。
Invalid Swift Support - The SwiftSupport folder is missing. Rebuild your app using the current public (GM) version of Xcode and resubmit it.
尝试制作简单的框架,但是
<小时/>The binary file 'test.dylib' is not permitted. Your app can’t contain standalone executables or libraries, other than the CFBundleExecutable of supported bundles.
library fpctest;
{$ifdef fpc}
{$mode delphi}
{$endif}
uses sysutils;
Function test (foo: integer) : integer; cdecl;
begin
Result := foo * 2;
end;
Exports
test;
end.
<小时/>
需要 dylib 的工作框架。
最佳答案
注释掉了项目特定部分。您可以通过创建一个虚拟框架并从那里复制来获取 Info.plist 和 DSYM Info.plist。
# set OUT_DIR and LIB_NAME
FW_PATH="$OUT_DIR/$LIB_NAME.framework"
INFO_PLIST="$FW_PATH/Info.plist"
OUT_DYLIB="$FW_PATH/$LIB_NAME"
# set the DYLIBS, SOURCE_INFO_PLIST and HEADER_PATH for the library
mkdir -p "$FW_PATH"
cp "$SOURCE_INFO_PLIST" "$INFO_PLIST"
lipo $DYLIBS -output "$OUT_DYLIB" -create
mkdir -p "$FW_PATH/Headers"
cp "$HEADER_PATH" "$FW_PATH/Headers"
install_name_tool -id @rpath/$LIB_NAME.framework/$LIB_NAME "$OUT_DYLIB"
# set the DYLIBS and SOURCE_INFO_PLIST for DSYM
OUT_DSYM_PATH="$FW_PATH.dSYM/Contents/Resources/DWARF"
INFO_PLIST="$FW_PATH.dSYM/Contents/Info.plist"
mkdir -p "$OUT_DSYM_PATH"
cp "$SOURCE_INFO_PLIST" "$INFO_PLIST"
lipo $DYLIBS -output "$OUT_DSYM_PATH/$LIB_NAME" -create
关于ios - 使用dylib创建ios框架,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57755276/