这是什么Objective-C/XCode批注////[START_EXCLUDE] [英] What is this Objective-C/XCode annotation // [START_EXCLUDE]

查看:75
本文介绍了这是什么Objective-C/XCode批注////[START_EXCLUDE]的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在以下位置查看iOS上GCM通知的示例代码: https://github.com/googlesamples/google-services/blob/master/ios/gcm/GcmExample/AppDelegate.m#L31

Looking at sample code for GCM notifications on iOS found here: https://github.com/googlesamples/google-services/blob/master/ios/gcm/GcmExample/AppDelegate.m#L31

....
// [START register_for_remote_notifications]
- (BOOL)application:(UIApplication *)application
      didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
      // [START_EXCLUDE]
      ....
      // [END_EXCLUDE]

//[START_EXCLUDE]//[END_EXCLUDE]的作用是什么.它是约定的一部分,还是目标C的一部分,还是xCode的一部分?

What purpose do the // [START_EXCLUDE] // [END_EXCLUDE] serve. Is it part of a convention, part of Objective C or something for xCode?

推荐答案

它是约定的一部分,还是目标C的一部分,还是xCode的一部分?

Is it part of a convention, part of Objective C or something for xCode?

以上都不是.就编译器而言,这些只是注释-它们不是任何标准Objective-C约定的一部分,也不是该语言的一部分,编译器可以理解的指令或Xcode可以理解的指令.

None of the above. Those are just comments as far as the compiler is concerned -- they aren't part of any standard Objective-C conventions, and they're not part of the language, directives that are understood by the compiler, or instructions understood by Xcode.

根据回购中的某些提交注释,[START ...][END ...]似乎是某种预处理器的指令,但是在构建项目时不会触发该预处理器.也许它们被项目外部的工具所使用,该工具可用于生成具有特定选项集的示例代码.如果您仔细阅读代码,会发现类似的指令,例如:

From some of the commit comments in the repo, the [START ...] and [END ...] seem to be directives to some sort of preprocessor, but that preprocessor isn't triggered when you build the project. Perhaps they're used by a tool that's external to the project, one that can be used to generate sample code with specific sets of options. If you look through the code, you'll find similar directives, such as:

// [START start_gcm_service]
...
// [END start_gcm_service]

所有这些似乎都围绕着可能从代码中删除的代码块.

and these all seem to surround chunks of code that might be excised from the code.

这篇关于这是什么Objective-C/XCode批注////[START_EXCLUDE]的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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