Export devices added in Apple's iOS Provision portal

本小妞迷上赌 提交于 2019-11-29 06:44:56

问题


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 backup for future use, these are 87 devices.

In new apple developer section I don't see any option to export all devices and I don't want to copy paste all 87 devices :(

Note: I want to export devices in the format required by the Apple for multiple device inserts.


回答1:


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.




回答2:


Open list of devices safari, chrome or firefox&firebug. Open web inspector (opt-cmd-i in safari), go to instrument tab (ctrl+3). Press "Start Recording" button and refresh page.

In the very bottom of the appeared list find "listDevices.action" and select it. In the right column of a web inspector copy & paste full URL and download JSON file with a list of devices. Then, with a simple regexp (i.e. /\"name\": \"([^\"]+)\",\n\s*\"deviceNumber\": \"([^\"]+)\"/ ) you can get devices' name and number.

Format that Apple accepts for upload is

Device ID   Device Name
A123456789012345678901234567890123456789    NAME1
B123456789012345678901234567890123456789    NAME2

Update:
Ah! Apple now provides a full deviceNumber on "iOS devices" page, so it makes whole process easier. Copy-paste the list in, for example, Sublime text and put devices' name and number in a proper order:

find: /^(.*) +([^\n]+)\n/
replace: \2\t\1\n




回答3:


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".




回答4:


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



回答5:


As of September 2019 this snippet that I have created (mixture of T.Nhan's answer above and Apple guidelines of upload format) works out of the box by just saving output in a .txt file and upload:

var data = document.querySelectorAll(".infinite-scroll-component .row");

var deviceListString = "Device ID\tDevice Name\tDevice Platform\n"
for (var i = 1; i < data.length; i++) {
  deviceListString += (data[i].childNodes[1].innerText + "\t" + data[i].childNodes[0].innerText + "\t" + (data[i].childNodes[2].innerText == "iPhone" || data[i].childNodes[2].innerText == "iPad" ? "ios" : "mac") + "\n");
}

console.log(deviceListString);



回答6:


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.




回答7:


Nowaday, Apple doesn't have JQuery anymore. We can use this query to get

var data = document.querySelectorAll(".infinite-scroll-component .row");
for(var i = 0 ; i < dencho.length; i++){
  var name =  data[i].childNodes[0];
  var id =  data[i].childNodes[1]
  console.log(name.innerText + "\t" +  id.innerText  + "\n");
}



回答8:


My solution to this was to create new provisioning profile here and add all devices to it. Then download it and open with vim (or any other editor). The file will contain some binary style and plist (xml) with all your devices, which can be parsed I guess, but I just c&p device list. Smth like:

<key>ProvisionedDevices</key>
   <array>
       <string>device1 udid</string>
       ....
       <string>deviceN udid</string>
   </array>

Delete your provisioning profile if you don't need it after.



来源:https://stackoverflow.com/questions/16052814/export-devices-added-in-apples-ios-provision-portal

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!