游戏邦在:
杂志专栏:
gamerboom.com订阅到鲜果订阅到抓虾google reader订阅到有道订阅到QQ邮箱订阅到帮看

针对iOS平台移植Flash内容的指导教程(5)

作者:Sina Kashanizadeh

这是基于FlashDevelop在PC平台免费制作AIR应用,然后作为原生应用发布至iOS设备制作教程系列的第5部分(请点击此处阅读本系列第一第二、第三、第四部分)。

iPad-AIR(from-untoldentertainment.com)

iPad-AIR(from-untoldentertainment.com)

发行证书

你已经根据自己的想法测试了应用,你便希望能将它推向App Store。请不要担心,我将详细地向你描述如何将应用上传到App Store。

整个发行过程可以说是苦乐参半。乐是因为这个过程与你刚刚完成的开发过程非常相像,所以你对于各种复杂的证书和要求可以说都非常熟悉了。而苦的就是,这几乎与你之前经历过的内容一模一样!

生成认证证书请求

还记得你在第二部分教程中所安装的OpenSSL程序吗?你需要再次打开该程序并创建另一个认证证书请求。其实也可以使用之前的认证证书,但是为了表达更清晰并避免任何混淆,我们才决定创造另一个证书。

注:我们将使用新的认证证书请求获得一个新的发行证书而不是开发证书。

1.打开命令提示符窗口。你可以点击启动Windows按钮,在搜索栏中中输入cmd。按住键盘上的Windows键和“R”键(代表“运行”),输入cmd后回车。

cmd(from untoldentertainment)

cmd(from untoldentertainment)

2.进入命令提示符后,打开Open SSL的bin文件夹。(游戏邦注:你的安装文件夹的位置可能有所不同,所以路径会与本示例不同,最好将Open SSL安装在你熟悉的地方!)

cd(from untoldentertainment)

cd(from untoldentertainment)

3.将以下命令符输入CLI并在完成后按回车:

openssl genrsa -out mykey.key 2048

你将会看到如下回应:

response(from untoldentertainment)

response(from untoldentertainment)

4.接下来输入(或者强调这一行,右击,选择“复制”,并右击/“粘帖”在CLI):

openssl req -new -key mykey.key -out CertificateSigningRequest.certSigningRequest  -subj “/emailAddress=yourAddress@example.com, CN=John Doe, C=US”

现在,在点击回车之前你还需要编辑一些内容。首先,用你自己的名字或公司名字替换“John Doe”。然后用自己的电子邮件替换“yourAddress@example.com”。点击回车。

你将会得到如下的信息:

response2(from untoldentertainment)

response2(from untoldentertainment)

如此你便生成了认证证书请求文件,并以此向苹果索要发行认证证书。认证证书请求文件保存在你的Open SSL所安装的文件夹中。它必须具有.certSigningRequest文件扩展名,如下:

signingRequest(from untoldentertainment)

signingRequest(from untoldentertainment)

获得发行认证证书

你必须在Apple Provisioning Portal中上传你的认证证书请求文件,以获得发行认证证书。

注:有很多例子表示在谷歌Chrome浏览器中不能进行上传。所以为了安全起见,我建议使用其它浏览器,如火狐。

1.来到开发中心的Apple Provisioning Portal。

portal(from untoldentertainment)

portal(from untoldentertainment)

2.注册你自己的开发者帐号并点击“证书”。

3.点击发行标签。

distribution(from untoldentertainment)

distribution(from untoldentertainment)

注:在以前的教程中,我们曾经在开发标签中请求认证证书。但是只是签署了开发证书的应用还不能成功提交到苹果的App Store中。

如果你之前开发过应用,你就可能拥有一份发行证书,而如果你仍希望继续遵循我们的教程创造一份新的证书,你可以选择取消之前的证书。取消证书并不会影响你之前发行在App Store中的应用,因为证书只会在上传过程中发挥作用(以便苹果识别你的身份)。

注:我建议你取消现有的证书,因为苹果似乎只允许每个团队使用一份证书。所以你只有取消现有的证书才能够请求一份新的证书。

revoke(from untoldentertainment)

revoke(from untoldentertainment)

4.如果你之前未拥有发行认证证书,你便可以继续并点击“请求证书”。

requestCertificate(from untoldentertainment)

requestCertificate(from untoldentertainment)

在下一个屏幕上传你在前一部分所生成的认证证书请求文件。

request(from untoldentertainment)

request(from untoldentertainment)

5.点击浏览按钮并来打开OpenSSL的bin文件夹。

6.选择认证证书请求文件并点击“提交”。完成后你便能够从网页上下载发行认证证书了。

yourCertificate(from untoldentertainment)

yourCertificate(from untoldentertainment)

但是现在你先不要下载发行证书。你仍然需要创建一个应用ID以及Mobile Provisioning Profile。

创建一个新应用ID

在决定你的应用ID时,你有两个选择:

创建一个全新的应用ID

使用你在教程2所创建的ID

如果你想使用你现有的应用ID,你就可以省下一个步骤。而如果你出于某种原因不喜欢现有的应用ID名称,你也可以遵循教程2的方法为自己创造一个新的应用ID。

创造一个用于发行的Mobile Provisioning Profile

拥有一个应用ID,你便能够创造Mobile Provisioning Profile。

1.在Provisioning Portal网站中点击侧边栏的“Provisioning”。

2.点击发行标签。

newProfile(from untoldentertainment)

newProfile(from untoldentertainment)

在之前的教程中我们已经创造了一个用于测试的开发概述。但是那时你还不能将你的应用上传到苹果的App Store,除非你创造出一个发行概述,并确保你选择了正确的标签。

你也可以创造一个新的Provisioning Profile,或者修改现有的概述。如果你希望在App Store和Ad Hoc之间转换,那么你便可以选择修改现有的概述。而如果你从未创造过发行概述,你就需要继续往下阅读。我们也将在后面的内容中阐述如何修改现有的概述。

3.点击“新概述”

newProfileButton(from untoldentertainment)

newProfileButton(from untoldentertainment)

注:只有付费团队管理员,才能看到这个选项。

4.在下一部分内容中你需要填写一些新的选项。第一个选项便是Distribution Method。正如你所看到的,你可以在App Store和Ad Hoc中做出选择。

如果你对应用感到满意并想要将其提交给苹果进行审核,你便可以选择App Store。如果一切进展顺利并且苹果认可了你的应用,它便能够正式发布了。

而Ad Hoc选项则可以当成是应用的一种封闭测试。当你选择Ad Hoc时,你可以最多向100个人发布你的应用,并且也只有这些人才能够访问你的应用。但是如果你选择Ad Hoc,你的应用便不可能出现在App Store。

注:你需要注意,当你选择App Store时,“设备”选项将呈现出灰色的。而当你选择Ad Hoc时,你便能够从注册过的多种设备中做出选择。因为如果你选择App Store。你便只能在App Store中发行你的设备,不能兼容其它设备。

5.你可以为你的Provisioning Profile命名。确保我们在此能够看到你所创造的发行证书。

6.最后,你应该选择你在注册Provisioning Profile时想要使用的应用ID。

profileOptions(from untoldentertainment)

profileOptions(from untoldentertainment)

7.点击“提交”。

8.你将看到自己所创造的一列Provisioning Profiles。在你所创造的Provisioning Profile中点击“下载”,并将其保存到自己的电脑上。

saveIt(from untoldentertainment)

saveIt(from untoldentertainment)

修改你的Provisioning Profile

注:如果你不想修改你现有的Provisioning Profile,那就跳过这个步骤。

1.在Provisioning Portal网站中点击侧边栏的“Provisioning”。

2.点击发行标签。

newProfile 2(from untoldentertainment)

newProfile 2(from untoldentertainment)

3.在你想要再次使用的Provisioning Profile上点击“修改”。

modifyProfile(from untoldtentertainment)

modifyProfile(from untoldtentertainment)

4.切换到Ad Hoc或App Store。

edit(from untoldentertainment)

edit(from untoldentertainment)

5.点击“提交”。

6.你将能够看到你所创造的一列Provisioning Profile。在你所修改的Provisioning Profiles中点击“下载”,并将其保存至你的电脑上。

saveIt 2(from untoldentertainment)

saveIt 2(from untoldentertainment)

下载你的发行证书

你只需要下载你在本教程最开始所创造的发行认证证书,然后就可以压缩你的.ipa文件并将其提交给App Store了。

1.点击侧边栏的“证书”。

2.点击发行标签。

distribution 2(from untoldentertainment)

distribution 2(from untoldentertainment)

3.这时你就可以下载发行认证证书了。你同时也会发现它包含了你所创造的Distribution Provisioning Profile。

ready(from untoldentertainment)

ready(from untoldentertainment)

点击“下载”并将文件保存在你的电脑上。为了让事情更加简单,你可以将证书保存在你的Open SSL bin文件夹中(游戏邦注:你已经在此里创建了认证证书请求文件)。

hooray(from untoldentertainment)

hooray(from untoldentertainment)

注:确保不要混淆了开发证书和概述以及你的发行证书和概述。如果你不小心在接下来步骤中使用了发行套件,你便不能在App Store上传应用。

将认证证书转换成.p12文件

现在要按以下几大步骤再次将你的证书中转换成.p12:

1.打开你的命令提示符。

2.打开你的Open SSL的bin文件夹。

3.复制并粘帖以下命令:

openssl x509 -in distribution_identity.cer -inform DER -out distribution_identity.pem -outform PEM

在输入这些命令后,你将在Open SSL bin文件夹中看到一份.pem格式的文件。

pem(from untoldentertainment)

pem(from untoldentertainment)

4.复制并将以下命令粘帖在CLI:

openssl pkcs12 -export -inkey mykey.key -in distribution_identity.pem -out iphone_dev.p12

注:这些命令符与你之前在开发证书时所使用的命令符一样,不过文件名从“开发”改成了“发行”。

5.输入命令符后,输入密码并确认密码。设定你自己能够记住的密码(将其以.txt文件形式保存)。

注:你可能会看到所谓的“random state”错误,只要输入RANDFILE=.rnd应该就能解决这个问题。

6.进入Open SSL目录中的bin文件夹,你便能够看到自己的.p12文件了。

p12(from untoldentertainment)

p12(from untoldentertainment)

游戏邦注:原文发表于2011年12月21日,所涉事件和数据均以当时为准。

本文为游戏邦/gamerboom.com编译,拒绝任何不保留版权的转载,如需转载请联系:游戏邦

Flash to iOS: A Step-by-Step Tutorial (Part 5)

by Sina Kashanizadeh

This is the fifth part of our tutorial series by Intern Sina on creating an AIR application for free on a PC using FlashDevelop, and deploying it as a native app on an iOS device like the Apple iPad, iPhone or iPod Touch.

Jump to other parts in the series:

Part 1 – Sign up for an Apple iOS Developer Account

Part 2 – Obtain your Signing Certificate & Mobile Provisioning

Profile, and create your App ID

Part 3 – Use FlashDevelop to build your mobile AIR app

Part 4 – Modify your project settings and test your app on an Apple device

Distribution Certificate

Now that you’ve tested your app and it’s to your liking, guess you want to put it up on the App Store? Never fear, my friend! I will now show you how to get your app uploaded on the App Store so the whole world can ignore it and buy Angry Birds instead.

This process of distribution is a bittersweet one. It’s sweet because it’s extremely similar to the development process that you just went through, so you should be familiar with the convoluted certificates and hoops you have to jump through at Apple’s pleasure. It’s bitter because it’s extremely similar to the development process that you just went through.

Something about this seems awfully familiar …

Enough talk. Let’s get cracking!

Generate a Signing Certificate Request

Remember that OpenSSL program that you installed in Part 2 of this tutorial? You have to open that bad boy up again to create another Certificate Signing Request. Now, it is possible to just use your old Signing Certificate – however, just to be super clear and to avoid any confusion or difficulty, we’re going to create another one.

Note: We’ll use this new Signing Certificate Request to get a Distribution Certificate rather than a Development Certificate.

1.Open a command prompt window. You can do this by clicking the Windows Start button and typing in cmd in the search field. Alternately, you can also hold the Windows key on your keyboard and hit the “R” key (for “Run”), then type cmd and hit Enter.

2.Once you are in the command prompt, navigate to your Open SSL bin folder. Depending on where you installed it, you will have to navigate to a different path than in this example. (i hope you installed Open SSL in a location that you can remember!) Check Part 2 if you need a refresher on Windows CLI (Command Line Interpreter) commands.

3.Punch this command into the CLI and hit the ENTER key when you’re finished:

You should see this response:

4.Next, type (or highlight the line, right-click, choose “Copy”, and right-click/”Paste” in the CLI):

Now, before you hit ENTER you’ll want to edit a couple of things. First, replace “John Doe” with your own name or company name. Then replace the “yourAddress@example.com” email with your own email. Press ENTER.
You should get a message similar to this:

You just generated the Signing Certificate Request file that you’ll use to ask Apple for your Distribution Signing Certificate. The Signing Certificate Request file is located in the bin folder of your Open SSL install. It has a .certSigningRequest file extension and should look like this:

Obtain a Signing Certificate for Distribution

You have to upload your Signing Certificate Request file to the Apple Provisioning Portal to get your Distribution Signing Certificate. Onward.

Note: There have been instances where this upload does not work with Google Chrome. Just to be safe, use another browser like Firefox.

1.Navigate to the Apple iOS Provisioning Portal within the Dev Center.

2.Log in with your developer account and click on Certificates.

3.Click on the Distribution tab.

Note: In our previous tutorials, you requested a certificate from the Development tab. An app signed with a Development certificate cannot be successfully submitted to the Apple App Store.

If you have an old Distribution Certificate because you’ve made a prior app, and you’d still like to follow along, you can go ahead and Revoke it. Revoking the Certificate will not affect your apps that are already on the App Store, because the Certificate is primarily used during the upload process so that Apple can identify you.

Note: I recommend revoking an existing Certificate because Apple seems to issue only one Certificate per Team Agent. You must revoke any existing Certificate to be able to request another. Why is it set up like this? I have no idea.

4.If you don’t have a pre-existing Distribution Signing Certificate, you can just go ahead and click Request Certificate.

On the next screen, you will upload the Signing Certificate Request file that you generated in the previous section.

Click the Browse button and navigate to the OpenSSL bin folder.

Select the Signing Certificate Request file and click Submit. When you are finished, you’ll see your Distribution Signing Certificate ready to download from the web page.

Don’t download your Distribution Certificate quite yet. You still need to create an App ID and a Mobile Provisioning Profile.

Create a New App ID

When deciding what you want your App ID to be, you have two choices:

Create an entirely new App ID

Use the Existing App ID that you create in Part 2

If you want to use your existing App ID, then just skip to the next section. If for some reason you don’t like the name of your App ID, go ahead and make a new App ID, following the steps outlined in Part 2.

Create a Mobile Provisioning Profile for Distribution

Now that you have an App ID, you can create your Mobile Provisioning Profile.

1.Within the Provisioning Portal website, click Provisioning in the sidebar.

2.Click the Distribution tab.

In previous tutorials, you created a Development profile for testing. You won’t be able to upload your app to the Apple App Store unless you create a Distribution profile, so make sure you select the correct tab.

You can either create a new Provisioning Profile, or modify an existing one. Modifying an existing profile if you want to switch between App Store and Ad Hoc distribution. If you’ve never created a Distribution profile, read on. Instructions for modifying a profile are in the section following.

3.Click on New Profile.

Note: You’ll only see this option if you are the fee-paying Team Admin.

4.In the next section, you’ll have to fill out a bunch of options. The first option is the Distribution Method. As you can see, you can choose between App Store and Ad Hoc.

Choose App Store if you are completely satisfied with your app and you want to submit it to Apple for review. If all goes well, then your app will be released whenever Apple deems it worthy.

The Ad Hoc option can be thought of as a closed beta for your app. When you choose Ad Hoc, you are able to release your app to a maximum of 100 people, and only they will have access to it. Your App will NOT appear in the public App Store if you choose Ad Hoc.

Note: Notice when you choose App Store, the “Devices” option is greyed out. When you choose Ad Hoc, it allows you to choose a number of devices that you have registered. The App Store option releases your app on the public App Store, so it doesn’t make sense to target specific devices.

5.Your Profile Name is the name that you want for your Provisioning Profile. The Distribution Certificate that you created should be visible here.

6.Finally, you have to choose which App ID with which you want to register your Provisioning Profile.

7.Click Submit.

8.You should ee a list of the Provisioning Profiles that you’ve created. Click download on the Provisioning Profile that you just created, and save it to you computer.

Modify your Provisioning Profile

Note: If you’re not modifying an existing Provisioning Profile (say, from Ad Hoc to App Store), skip over this section.

1.Within the Provisioning Portal website, click Provisioning in the sidebar.

2.Click the Distribution tab.

3.Click Modify on the Provisioning Profile that you want to reuse.

4.Switch to either Ad Hoc or App Store. The distinction between these two options is explained in the preceding section.

5.Click Submit.

6.You should see a list of the Provisioning Profiles that you’ve created. Click download on the Provisioning Profile that you just modified, and save it to your computer.

Download your Distribution Certificate

You just need to download the Distribution Signing Certificate that you created at the top of this tutorial, and then you are ready to bundle your .ipa file to submit to the App Store.

1.Click on the Certificates section in the sidebar.

2.Click the Distribution tab.

3.You’ll see that your Distribution Signing Certificate is ready to download. You can also see that it contains the Distribution Provisioning Profile that you just made.

Click download and save the file to your computer. Just to make things easier, you can save that certificate in the Open SSL bin folder, where your Certificate Signing Request file is sitting.

Note: Make sure not to get confused between your Development Certificate and Profile, and your Distribution Certificate and Profile. You won’t be able to upload your app to the App Store if you accidentally use the Distribution set of certs in these next steps.

Convert the Signing Certificate to a .p12 File

You’ll have to perform the .p12 conversion on your Certificate again, as you did in an earlier tutorial. Here are the steps:

1.Open up your command prompt.

2.Navigate to your Open SSL bin folder.

3.Copy and paste this command:

After you enter that command, you’ll see a .pem file show up in your OpenSSL bin folder.

4.Copy and paste this command in the CLI:

Note: These are the exact same commands that you used for our Development Certificate in an earlier tutorial, except that the file name has been changed from “development” to “distribution”.

5.After you punch in the command, enter a password and then verify that password. Make sure the password is something that you will remember. (Save it in a .txt file! – Ed.)

Note: Remember that you may get an error mentioning a “random state”. Just type in the command set RANDFILE=.rnd and it should fix the problem for you.

6.Navigate to the bin folder in your Open SSL directory and you should see your .p12 file. Hooray!(source:untoldentertainment)


上一篇:

下一篇: