Is it possible to get the local IP address from the DEFINE preprocessor in Objective-C?

This is probably a long shot, but it does not bother to ask ...
Do you find it possible to get the IP address of the assembly node when creating for iOS in Objective-C under xcode?
This would be useful for my testing, if possible.
For instance:

NSString* backendUrl = [NSString stringWithFormat:@"http://%@:5000/", HOST_IP];

Where I would expect HOST_IP(if something like that) there was something like this, but of course it was automatically controlled during the build to keep the correct IP:

#define HOST_IP @"172.76.77.5"
+5
source share
2 answers

There is no convenient solution, but here are some options to consider.

+3

, , , , -

static NSString *HOST_IP;

-(id)init
{
   if (self = [super init])
   {
       HOST_IP = // Your code
    }
    return self;
}

- , , , .

0

All Articles