Export devices added in Apple's iOS Provision portal

后端 未结 10 1385
予麋鹿
予麋鹿 2020-12-25 14:41

My apple developer is about to expire in 5 days. And after renewal I want to restore my devices count to 100 but meanwhile I want to export all currently added devices as ba

相关标签:
10条回答
  • 2020-12-25 15:02

    None of the above worked for me, most likely because Apple changed the format. But what did work perfectly was the following:

    • copy/paste all the items from Apple's devices page
    • paste into Numbers, device ID and names are recognised as 2 distinct columns
    • drag the column order so devices are first rather than names
    • copy/paste all rows into a text file
    • upload to Apple and you're done
    0 讨论(0)
  • 2020-12-25 15:05

    You can use a command tool call Spaceship, it exposes both the Apple Developer Center and the iTunes Connect API

    Here is how I did to migrate all my devices from my Apple Developer account to a second one.

    spaceship1 = Spaceship::Launcher.new("account1@email.com", "password")
    spaceship2 = Spaceship::Launcher.new("account2@email.com", "password")
    
    #Get all devices from the Apple Developer account 1.
    devices = spaceship1.device.all
    
    #Loop through all devices from account 1 and then add/create them in account2.
    devices.each do |device| spaceship2.device.create!(name: device.name, udid: device.udid) end
    

    Note: To quickly play around with spaceship launch irb in your terminal and execute require "spaceship".

    0 讨论(0)
  • 2020-12-25 15:05

    Check out Mattt's command line interface tool, Cupertino

    You can run ios devices:list to get the list of devices on your account.

    It probably isn't the exact format for Apple's importer, but it should get you to a good point, there is also ios devices:add that will let you re-add your devices from the command line.

    0 讨论(0)
  • 2020-12-25 15:05

    Looks like the webpage structure has been edited a little since the latest response. My new snippet also formats the output as CSV, so you can save the output and open it with Numbers/Excel and share it.

    var data = document.querySelectorAll(".infinite-scroll-component .row");
    var csvOutput = "Name, Identifier, Type\n"
    
    for (var i = 1; i < data.length; i++) {
        let name = data[i].childNodes[0].childNodes[0].textContent;
        let identifier = data[i].childNodes[1].childNodes[0].textContent;
        let type = data[i].childNodes[2].childNodes[0].textContent;
        let device = [name, identifier, type].join(", ") + "\n";
        csvOutput += device;
    }
    
    console.log(csvOutput);

    0 讨论(0)
  • 2020-12-25 15:06

    If you're looking for an option that doesn't require additional software, recordings, or fiddling with regular expressions, here's a JavaScript snippet you can run in Chrome's (or I'd assume, any other browser's) JavaScript console to get a properly-formatted device list:

    var ids = ["Device ID"];
    var names = ["Device Name"];
    $("td[aria-describedby=grid-table_name]").each(function(){
        names.push($(this).html());
    });
    $("td[aria-describedby=grid-table_deviceNumber]").each(function(){
        ids.push($(this).html());
    });
    
    var output = "";
    for (var index = 0; index < ids.length; index++) {
        //output += names[index] + "\t" + ids[index] + "\n";    //original
        output += ids[index] + "\t" + names[index] + "\n";      //post September 2016
    }
    console.log(output);
    

    The complete export will be logged to the console, at which point you can simply copy/paste it into an empty text document, which can then be re-imported back to Apple at any time.

    This works with Apple's current developer site layout, as of April 2015. Obviously it may break if they change stuff.

    0 讨论(0)
  • 2020-12-25 15:06

    In my case, I also want to get the device model (ex, iPhone X, iPhone 8....) You can get any device info base on UDID with object var object = JSON.parse(this.responseText);

    var data = document.querySelectorAll(".infinite-scroll-component .row");
    var deviceListString = ""
    var databody = JSON.stringify({
      teamId: 'XXXXXXXX' // your team id here
    })
    
    for (var i = 1; i < data.length; i++) {
        var xhr = new XMLHttpRequest()
        xhr.withCredentials = true
        xhr.addEventListener('readystatechange', function() {
            if (this.readyState === this.DONE) {
                var object = JSON.parse(this.responseText);
                deviceListString += object.data.attributes.name + "\t" + object.data.attributes.model + "\t" +object.data.attributes.udid + "\n";
            }
        })
    
        var rowID = data[i].getAttribute('data-id');
        var url = `https://developer.apple.com/services-account/v1/devices/${rowID}?fields[devices]=name,udid,platform,model,status,devicePlatformLabel`
        xhr.open('POST', url);
        xhr.setRequestHeader('content-type', 'application/vnd.api+json');
        xhr.setRequestHeader('x-http-method-override', 'GET');
        xhr.send(databody);
    }
    

    When you type enter, the result was stored in deviceListString So just get that value

    deviceListString
    

    This is screenshot:

    0 讨论(0)
提交回复
热议问题