Bringing Location to the Internet

Cocoa Library

This is a Cocoa library that enables the user to find the country, region, city, coordinates, zip code, time zone, ISP, domain name, connection type, area code and weather 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 IP2Location Cocoa Library (958.39 kB) Version: 5.0.0

 

Installation
  1. Download and decompress Cocoa library.
    unzip ip2location-cocoa-x.x.x.zip
  2. Download IP2Location C library at here.
  3. Decompress C library.
    tar ip2location-c-x.x.x.tar.gz
  4. Copy C library into same directory with IP2Location.xcodeproj.
    cp ip2location-c-x.x.x ip2location-cocoa-x.x.x
  5. Open IP2Location.xcodeproj with XCoder and make sure all libraries path are correct, and without any error.
  6. Change the path of IP2Location BIN database in main.m.
  7. Compile the project.

 

Sample Codes
require 'IP2Location'

#import <foundation/nsautoreleasepool.h>
#import <foundation/nsstring.h>
#import "IPLocation.h"
int main (int argc, const char *argv[])
{
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];

NSString *dataPath = @"IP-COUNTRY-REGION-CITY-LATITUDE-LONGITUDE-ZIPCODE-TIMEZONE-ISP-DOMAIN-NETSPEED-AREACODE-WEATHER-MOBILE-ELEVATION-USAGETYPE-SAMPLE.BIN";
NSString *ip = @"55.207.38.82";
IPLocation *loc = [IPLocation locationWithIP:ip dataPath:dataPath];
printf("* * * * * IP %s * * * * *:\n%s", [ip UTF8String], [[loc description] UTF8String]);

[pool drain];
return 0;
}
Credit: Thanks to Kevin Wojniak for codes contribution.

 

Sample Database (BIN)

Evaluation version of the database file having limited range of IP address information. You can query all IP addresses from 0.0.0.0 to 99.255.255.255 only.