Solved

How to access Apple's advertiserIdentifier with javascript

Posted on 2013-06-24
2
2,565 Views
Last Modified: 2013-07-03
Is it possible to access the advertisingIdentifier (IDFA) in iOS 6 using javascript from within an App?
0
Comment
Question by:Rossamino
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
2 Comments
 
LVL 7

Expert Comment

by:pegasys
ID: 39294176
You can't get that IDFA via javascript. What you need to do is pull that from the app itself and push the ID to the script from the app.

[[ASIdentifierManager sharedManager] advertisingIdentifier]

Open in new window


Is what pulls the IDFA. What I'd do is get that, and the page which has the JScript on it, I'd have a querystring like this:

https://api.mysite.com/api/theJSPage.php?DeviceIDFA=123123123123

There's no other way to do it.
0
 
LVL 7

Accepted Solution

by:
pegasys earned 500 total points
ID: 39294187
something to the effect of:

    NSString *myIDFA = [[ASIdentifierManager sharedManager] advertisingIdentifier];
    NSString *urlString = [NSString stringWithFormat:@"https://api.mysite.com/api/theJSPage.php?DeviceIDFA=%@",myIDFA] 
    NSURL *websiteUrl = [NSURL URLWithString:urlString];
    NSURLRequest *urlRequest = [NSURLRequest requestWithURL:websiteUrl];
    [myWebView loadRequest:urlRequest];

Open in new window

0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

     Intro      In this article, I will show you how to parse a JSON in Swift using an open source library called SwiftyJSON (https://github.com/SwiftyJSON/SwiftyJSON). If you haven't heard of a JSON before, it stands for JavaScript Object Notation…
Is your phone running out of space to hold pictures?  This article will show you quick tips on how to solve this problem.
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

696 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question