Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/117.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 绘制PDF时使用CFAttributedString_Ios_Cocoa Touch_Pdf_Nsattributedstring - Fatal编程技术网

Ios 绘制PDF时使用CFAttributedString

Ios 绘制PDF时使用CFAttributedString,ios,cocoa-touch,pdf,nsattributedstring,Ios,Cocoa Touch,Pdf,Nsattributedstring,我真的被这件事缠住了。 我主要使用了来自的代码,它工作得很好。现在我正试图改变1部分,我不断地得到错误 CFAttributedStringRef currentText = CFAttributedStringCreate(NULL, (CFStringRef)textView.text, NULL); if (currentText) { CTFramesetterRef framesetter = CTFramesetterCreateWithAttributedString(cu

我真的被这件事缠住了。 我主要使用了来自的代码,它工作得很好。现在我正试图改变1部分,我不断地得到错误

CFAttributedStringRef currentText = CFAttributedStringCreate(NULL, (CFStringRef)textView.text, NULL);
if (currentText) {
    CTFramesetterRef framesetter = CTFramesetterCreateWithAttributedString(currentText);
    if (framesetter) {
我试图用一个字符串替换
textView.text
,这样就可以使用字符串中的数据而不是文本视图来构建PDF,但是当我将该代码更改为

CFAttributedStringRef currentText = CFAttributedStringCreate(NULL, (CFStringRef)stringHere, NULL);
这让我感到错误:

Thread 1: EXC_BAD_ACCESS (code=1, address0x0).
我也试过:

CFStringRef stringRef = (CFStringRef)stringHere;
CFAttributedStringRef currentText = CFAttributedStringCreate(NULL, stringRef, NULL);

但我也犯了同样的错误。有人能帮忙吗?

stringHere是0x0(又名nil又名NULL)

是的,我发现了一些我没有检查的东西,这正是问题所在^