Ios 绘制PDF时使用CFAttributedString
我真的被这件事缠住了。 我主要使用了来自的代码,它工作得很好。现在我正试图改变1部分,我不断地得到错误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
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)是的,我发现了一些我没有检查的东西,这正是问题所在^