在IOS Objective

编程入门 行业动态 更新时间:2024-10-17 15:30:24
IOS Objective-C代码中添加多个目标头(Add Multiple Target Header in IOS Objective-C code)

我正在编写一个用Objective-C编写的项目。 当前的应用程序有三个基于环境的目标(Dev,Prelive和Live)。

现在我必须添加必须用Swift语言编写的新功能。 我遵循这个链接和应用程序在开发目标(即环境)中成功编译。

在objective-C文件中,我添加了如下标题

#import“Dev-Swift.h”

我已经在多个文件中导入了'Dev-Swift.h'之上。

现在的问题是,我有三个目标,并假设如果我必须运行任何其他目标(说Prelive),那么我必须在多个文件中再次对头进行更改,这将是

导入“Prelive-Swift.h”

这将是一项艰巨的任务,并可能在改变目标的同时引发错误。

任何人都可以建议如何解决这个问题。 每当我改变目标时我都不想要改变标题。

如果我更多地澄清问题,请告诉我。

I am working on a project written in Objective-C. Current app has three target based on environment(Dev, Prelive and Live).

Now I have to add new functionality which must be written in Swift language. I follow this link and app complied successfully in Dev target (i.e. Environment) .

In objective-C files I have added header as below

#import "Dev-Swift.h"

and I have imported above 'Dev-Swift.h' in multiple files.

Now issue is that I have three target and suppose If I have to run on any other target(Say Prelive) then I have to made changes with header again in multiple files & it will be

import "Prelive-Swift.h"

which will be again a tough task & may leads error while changing target.

Can any one suggest how to tackle this issue. I do not want change header every time when I change target.

Let me know if I have clarify question more.

最满意答案

你是否尝试为三种环境设置相同的名称? 在这种情况下,您不需要每次都像这样更改文件名称: 在这里输入图像描述

did you try to put the same name for the three environment. in this case you don't need to change the file name each time like this : enter image description here

更多推荐

本文发布于:2023-07-25 05:44:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1256804.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:IOS   Objective

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!