“setxattr”的声明必须在需要之前从模块“Darwin.POSIX.sys.xattr”导入
Declaration of ‘setxattr’ must be imported from module ‘Darwin.POSIX.sys.xattr’ before it is required
代码在 armv7 上运行良好,但为 arm64 编译会抛出此 "Declaration of ‘setxattr’ must be imported from module ‘Darwin.POSIX.sys.xattr’ before it is required" 错误。
u_int8_t b = 1;
setxattr([path fileSystemRepresentation],
"com.apple.MobileBackup", &b, 1, 0, 0);
有什么帮助吗?
我找到了解决方案。
在 class
中包含 #include <sys/xattr.h>
代码在 armv7 上运行良好,但为 arm64 编译会抛出此 "Declaration of ‘setxattr’ must be imported from module ‘Darwin.POSIX.sys.xattr’ before it is required" 错误。
u_int8_t b = 1;
setxattr([path fileSystemRepresentation],
"com.apple.MobileBackup", &b, 1, 0, 0);
有什么帮助吗?
我找到了解决方案。 在 class
中包含#include <sys/xattr.h>