implementing GCMathParser on iphone

2019-08-14 06:08发布

i am trying to use the GCMathParser for an iphone application and i cannot find any support on implementing this framework. people keep saying its easy and im kinda confused, any help would be great thanks!

2条回答
闹够了就滚
2楼-- · 2019-08-14 06:26

There are two changes you need to make in order to use this:

  1. Change #import <Cocoa/Cocoa.h> to #import <UIKit/UIKit.h> (You could probably get away with using <Foundation/Foundation.h>, too)
  2. Try to compile again. You'll get errors about an unknown symbol "pi". Change the three occurrences of those to M_PI (the constant defined in <math.h> for π).

You'll still get warnings (about deprecated methods), but it will compile and work.

查看更多
三岁会撩人
3楼-- · 2019-08-14 06:34

If you have UI classes, then you will need to remove them (as you noted you have). If you have non-UI classes importing Cocoa.h, they generally shouldn't be (AppKit, which is implemented in Cocoa.h, is mostly UI). Replace Cocoa.h with #import <Foundation/Foundation.h>. If they actually rely on things in Cocoa.h, then you have porting work to do.

查看更多
登录 后发表回答