绑定的#define作为常数 [英] Binding #define used as constant

查看:136
本文介绍了绑定的#define作为常数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在code我试图把绑定一个非常重要的关键在.h文件之一:

The code I am trying to bind puts a very important key in one of the .h files:

#define xAppKey @"REPLACE_WITH_YOUR_APP_KEY"

此值然后在整个ObjC code重用。我怀疑,在结合过程中,此值不贯彻。基于在SO几个其他线程,这似乎是的情况下,至少。是我的问题很可能其他的东西,或者是有这个值是不是在包裹code被荣幸的机会吗?

This value is then reused throughout the ObjC code. I am suspicious that in the binding process, this value does not carry through. Based on a few other threads on SO, that seems to be the case, at least. Is my problem likely something else, or is there a chance this value is not being honored in the wrapped code?

我很抱歉,如果我的Objective-C的术语是关闭的,我什么都不知道了。

I'm sorry if my objective-c terminology is off, I know nothing about it.

修改

我只是想澄清什么可能不是很明显。通过绑定我指的是结合它的MonoTouch作为本机库。如果是已经明确,进行...

I just wanted to clarify what may not have been evident. By "binding" I am referring to binding it to monotouch as a native library. If that was clear already, carry on...

推荐答案

具有A点的#define 在一个OBJ-C .H 是,以允许它通过应用程序利用该库来代替。在这种情况下,你(的OBJ-C)库大概分布为唯一来源。

The point of having a #define in an Obj-C .h is to allow it to be replaced by the application leveraging the library. In this case, your (Obj-C) library is probably distributed as sources only.

但你要为它创建(Xamarin.iOS)绑定。所以,你需要的编译这个库和编译将修复价值的 xApiKey 一劳永逸。

But you want to create (Xamarin.iOS) bindings for it. So you need to compile this library, and compiling will fix the value of the xApiKey once and for all.

你的目标可能是使本 xApiKey 通过Xamarin.iOS消费应用程序。你必须修改的OBJ-C 库使用属性,而不是恒定的,然后通过 Xamarin绑定(静态)属性访问。 iOS版

Your aim is probably to expose this xApiKey to the consuming application through Xamarin.iOS. You'll have to modify the Obj-C library to use a property instead of a constant, then bind the (static) property accessors through Xamarin.iOS

这篇关于绑定的#define作为常数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆