如何在带有ARC的iOS 5应用程序(XCode 4.2)中使用GCMathParser? [英] How to use GCMathParser in iOS 5 application (XCode 4.2) with ARC?
问题描述
更改后
-#import <Cocoa/Cocoa.h>
至#import <UIKit/UIKit.h>
-从"pi"到"M_PI"的
并为GCMathParser文件禁用ARC时,出现以下错误:(多个位置)
After changing
- #import <Cocoa/Cocoa.h>
to #import <UIKit/UIKit.h>
- "pi" to "M_PI"
and disabling ARC for the GCMathParser files, I get the following error: (multiple places)
将C指针类型"void *"转换为Objective-C指针类型"GCMathParser *"需要桥接转换
Cast of C pointer type "void*" to Objective-C pointer type "GCMathParser*" requires a bridged cast
我该怎么办?
谢谢
推荐答案
ARC不允许您将对象隐藏在未类型化的指针后面,而是需要知道哪些指针是对象才能发挥作用.如果您要处理一个严重依赖该技巧的框架,则可能必须进行大量的重新架构.不好玩.
ARC doesn't let you hide objects behind untyped pointers -- it needs to know which pointers are objects in order to do its magic. If you're dealing with a framework that relies heavily on that trick, you may have to do a fair amount of re-architecting it. Not fun.
您可以尝试 DDMathParser ;它在功能上相似,更具扩展性,并且开箱即用"支持ARC和iOS.
You might try DDMathParser instead; it's functionally similar, more extensible, and supports ARC and iOS "out of the box".
这篇关于如何在带有ARC的iOS 5应用程序(XCode 4.2)中使用GCMathParser?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!