C Library
PHP Module
Perl Module
Ruby Library
Python Library
Apache Module
Nginx Module
Node.js Module
Cocoa / Objective C Library
Pascal Library
D Library
Go Package
Erlang Module
Haskell Package
Debian Package
Lua Package
Kotlin Module
Scala Library
OpenResty Package
Splunk Add-on
Apache Kafka Transform
OCaml Module
Deno Module
R Package
.NET Component
Java Component
HTTP Module
ActiveX / COM DLL
IP2Location IP Geolocation Cocoa Library
This is a IP Geolocation Cocoa library that enables the user to find the country, region, city, coordinates, ZIP code, time zone, ISP, domain name, connection type, area code, weather, MCC, MNC, mobile brand name, elevation and usage type that any IP address or hostname originates from. It has been optimized for speed and memory utilization. Developers can use the API to query all IP2Location™ binary databases for applications written in C or supporting static/dynamic library.
- Download and decompress ip2location-cocoa-x.x.x.zip
- For Xcode usage:
- Add ip2location.framework to your Xcode project by dragging and dropping it into Project Navigator
- In your appropriate target, under "Build Settings", select "Runpath Search Paths" in the "Linking" category, and enter "@loader_path/../Frameworks" (without the quotes).
- Build your project
- For build from command line or makefile
- Copy ip2location.framework to your working directory
- Build and link your target with following options added (without the quotes): "-F. -L. -Wl,-framework,ip2location -Wl,-framework,Foundation"
- Change linked framework path in your binary: "install_name_tool -change @rpath/ip2location.framework/Versions/A/ip2location ip2location.framework/Versions/A/ip2location binary_executable"
#import <Foundation/Foundation.h>
#import <ip2location/IP2Location.h>
int main(int argc, const char * argv[])
{
@autoreleasepool {
//open database
IPLocation *locationDB = [[IPLocation alloc] initWithDataPath: @"data/IP-COUNTRY-SAMPLE.BIN"];
//set memory cache type
[locationDB setMemoryType: IP2LOCATION_MEMORY_CACHE];
//search
IPLocationRecord *rec = [locationDB recordWithIP: @"8.8.8.8"];
NSLog(@"%@", rec.countryShort);
}
return 0;
}
Discover Your User Locations
Retrieve geolocation data for FREE now!