gpt4 book ai didi

ios7 - 在 Xcode 5 中安装 asn1c 库,用于 ios7 中的收据验证

转载 作者:行者123 更新时间:2023-12-02 08:38:17 25 4
gpt4 key购买 nike

我正在为收据验证而绞尽脑汁。

我正处于验证证书是否有效并且需要解析 ASN1 文件的阶段。

Apple建议使用asn1c,例如:

 #include "Payload.h" /* This header file is generated by asn1c. */

void *pld = NULL;
size_t pld_sz;

Payload_t *payload = NULL;
asn_dec_rval_t rval;

rval = asn_DEF_Payload.ber_decoder(NULL, &asn_DEF_Payload, (void **)&payload, pld, pld_sz, 0);

我已经从以下位置下载了 asn1c-master.zip:https://github.com/vlm/asn1c

现在我不知道如何将此库安装到 Xcode 中,如果我需要一些额外的工作,或者我可以在安装 asn1c 后以 Apple 示例启动吗?

感谢您的帮助。

编辑:

我按照安装文件中的说明进行操作:在 asn1c-master 文件中,我在终端中运行:

./configure
make
make check
make install

之后,我在单独的文件夹文件 receipt.asn1 中创建并在其中添加以下文本:

 ReceiptModule DEFINITIONS ::=
BEGIN

ReceiptAttribute ::= SEQUENCE {
type INTEGER,
version INTEGER,
value OCTET STRING
}

Payload ::= SET OF ReceiptAttribute

END

之后我运行

asn1c -fnative-types receipt.ans1

但是我很伤心:

-fnative-types: Deprecated option
ASN.1 grammar parse error near line 1 (token "{"): syntax error, unexpected '{', expecting TOK_typereference or TOK_capitalreference
Cannot parse "receipt.asn1"

最佳答案

按照http://github.com/vlm/asn1c/blob/master/INSTALL中的说明进行操作后

我在新目录(即 Mac OS X 文件夹)中执行以下操作:

# Terminal command line from: https://developer.apple.com/library/ios/releasenotes/General/ValidateAppStoreReceipt/Chapters/ValidateLocally.html#//apple_ref/doc/uid/TP40010573-CH1-SW3
asn1c -fnative-types receipt.ans1
# the file receipt.ans1 has contents from Listing 1-1 in the above URL

# converter-sample.c has a main. Don't want that!
rm converter-sample.c

rm Makefile.am.sample

然后,确保将生成的.c和.h文件拖到Xcode组中,不要将Mac文件夹直接放入项目中,否则.c和.h文件将不会添加到Xcode中项目。因此,它们不会构建,并且您将收到链接器错误

关于ios7 - 在 Xcode 5 中安装 asn1c 库,用于 ios7 中的收据验证,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22690005/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com