<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Xcode &#8211; Gary&#039;s &#8230;Lasamia</title>
	<atom:link href="https://garynil.tw/tag/xcode/feed/" rel="self" type="application/rss+xml" />
	<link>https://garynil.tw</link>
	<description>🍎 📱 🖥 🔨 😄</description>
	<lastBuildDate>Tue, 27 Feb 2018 14:51:47 +0000</lastBuildDate>
	<language>zh-TW</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.0.3</generator>

<image>
	<url>https://i0.wp.com/garynil.tw/wp-content/uploads/2017/01/cropped-Gary_v3.0.jpg?fit=32%2C32&#038;ssl=1</url>
	<title>Xcode &#8211; Gary&#039;s &#8230;Lasamia</title>
	<link>https://garynil.tw</link>
	<width>32</width>
	<height>32</height>
</image> 
<site xmlns="com-wordpress:feed-additions:1">147732124</site>	<item>
		<title>[Tutorial] How to build Electra ( iOS 11 Jailbreak app ) with ldid2</title>
		<link>https://garynil.tw/2018/01/691/tutorial-build-electra-ios-11-jailbreak-app-ldid2/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=tutorial-build-electra-ios-11-jailbreak-app-ldid2</link>
					<comments>https://garynil.tw/2018/01/691/tutorial-build-electra-ios-11-jailbreak-app-ldid2/#comments</comments>
		
		<dc:creator><![CDATA[Gary]]></dc:creator>
		<pubDate>Fri, 26 Jan 2018 07:20:35 +0000</pubDate>
				<category><![CDATA[Dev]]></category>
		<category><![CDATA[iOS]]></category>
		<category><![CDATA[Apple]]></category>
		<category><![CDATA[build]]></category>
		<category><![CDATA[Electra]]></category>
		<category><![CDATA[ios11]]></category>
		<category><![CDATA[Jailbreak]]></category>
		<category><![CDATA[Mac]]></category>
		<category><![CDATA[Xcode]]></category>
		<category><![CDATA[越獄]]></category>
		<guid isPermaLink="false">https://garynil.tw/?p=691</guid>

					<description><![CDATA[<p>Coolstar has released a new beta version of Electra jailbreak toolkit for iOS 11 – iOS 11.1.2. The author also release the source code of the jailbreak toolkit on Github. I would like to try to find out how the toolkit work by building it on my own. So I wrote this guide for people (who may be a developer) can follow instructions and build Electra toolkit successfully. The most important of all, b...</p>
<p>這篇文章 <a rel="nofollow" href="https://garynil.tw/2018/01/691/tutorial-build-electra-ios-11-jailbreak-app-ldid2/">[Tutorial] How to build Electra ( iOS 11 Jailbreak app ) with ldid2</a> 最早出現於 <a rel="nofollow" href="https://garynil.tw">Gary&#039;s ...Lasamia</a>。</p>
]]></description>
										<content:encoded><![CDATA[<p><a href="https://twitter.com/coolstarorg">Coolstar</a> has released a new beta version of <a href="https://coolstar.org/electra/">Electra</a> jailbreak toolkit for iOS 11 – iOS 11.1.2. The author also release the source code of the jailbreak toolkit on <a href="https://github.com/coolstar/electra">Github</a>. I would like to try to find out how the toolkit work by building it on my own. So I wrote this guide for people (who may be a developer) can follow instructions and build Electra toolkit successfully.</p>
<p><img fetchpriority="high" decoding="async" src="https://i0.wp.com/lh3.googleusercontent.com/LUQPFWITqe-Tm6oW6rmpTgrB1KbOkKQhDWCJiPrHEVrmlMUAIwdvAvHk6P8" width="1600" height="1427" class="aligncenter size-full" /></p>
<p>The most important of all, before you start to read this guide, make sure you have the ability to handle the problem you meet. You are fully doing this at your own risk, I&#8217;m not responsible for any damage caused.</p>
<p>If you don&#8217;t know what this article is doing, you can download the released ipa on the author <a href="https://coolstar.org/electra/">website</a> resign by tools such as <a href="https://github.com/maciekish/iReSign">iResign</a> and install it to your iPhone without building it youself.</p>
<p><span id="more-691"></span></p>
<h4>Advantage of build the toolkit yourself</h4>
<ol>
<li>Know the structure of the code</li>
<li>Preventing if there were malicious code in toolkit.</li>
<li>Remove unused features. For example, in this toolkit, it will install Anemone tweak after you jailbreak. The last part in this tutorial will told you how to do it.</li>
<li>Keep the latest version, you can pull the latest version from Github and build it yourself.</li>
<li>You need to turn the SIP off of macOS before you did these instructions.</li>
</ol>
<h2>Clone repo</h2>
<p>You can access the Electra repo on <a href="https://github.com/coolstar/electra">Github</a>, which contain a Xcode project.<br />
Clone it to your ~/Desktop or any other path you like to work with.</p>
<p></p><pre class="urvanov-syntax-highlighter-plain-tag">git clone https://github.com/coolstar/electra.git</pre><p></p>
<p><a href="//i0.wp.com/lh3.googleusercontent.com/MjLpIWf3lGmh1pvhgDYZ3OSh2Up386AFRXHHF7ejUmnksTJDXGJGT63B1zI" data-featherlight="image"><img decoding="async" alt="Array" src="//i0.wp.com/lh3.googleusercontent.com/MjLpIWf3lGmh1pvhgDYZ3OSh2Up386AFRXHHF7ejUmnksTJDXGJGT63B1zI" width="811" height="600" scale="2"></a></p>
<h2>Build Xcode project</h2>
<p>Open the Xcode project then build. You will meet some error with the clean Xcode environment.</p>
<h2>ldid2 error</h2>
<p>After you build the project, you will meet a error. You will see this error:</p>
<p><a href="//i0.wp.com/lh5.googleusercontent.com/vZU-gDoh2jhgFA8eBncA2CFIBVkgO3Shf3kJ1iVUzIpYQE9CpgunWAQ7y0Y" data-featherlight="image"><img decoding="async" alt="Array" src="//i0.wp.com/lh5.googleusercontent.com/vZU-gDoh2jhgFA8eBncA2CFIBVkgO3Shf3kJ1iVUzIpYQE9CpgunWAQ7y0Y" width="875" height="600" scale="2"></a></p>
<p>At the first test, I tried install ldid original version by</p>
<p></p><pre class="urvanov-syntax-highlighter-plain-tag">brew install ldid</pre><p></p>
<p>and the bin of the ldid would be at <code>/usr/local/Cellar/ldid/1.2.1</code>, then link it as ldid2 in <code>/usr/local/bin</code></p>
<p></p><pre class="urvanov-syntax-highlighter-plain-tag">ln -s /usr/local/Cellar/ldid/1.2.1/bin/ldid /usr/local/bin/ldid2</pre><p></p>
<p><a href="//i0.wp.com/lh4.googleusercontent.com/s6XTUMGfpfA7ta-e3zueDiD6E66a1I8YJ9U5yEFdcAqyEfhNWoMP0QUMg4Y" data-featherlight="image"><img loading="lazy" decoding="async" alt="Array" src="//i0.wp.com/lh4.googleusercontent.com/s6XTUMGfpfA7ta-e3zueDiD6E66a1I8YJ9U5yEFdcAqyEfhNWoMP0QUMg4Y" width="837" height="600" scale="2"></a></p>
<p>With the ldid, it can work, and you can build the toolkit into your iPhone. However, the jailbreak won&#8217;t success and block on 2/3.</p>
<p>So I tried to find the solution on Github. I found <a href="https://github.com/xerub">xerub</a> make a <a href="ldid2">ldid2</a> with SHA256 support. However, this repo is not complete. The repo are lack of make code and wasn&#8217;t build.</p>
<h2>Add ldid2 to <code>/usr/local/bin/</code></h2>
<p>I completed the ldid2 project and put the binary in release version <a href="https://github.com/GaryniL/ldid/releases/tag/0.1-2">page</a>.<br />
<a href="https://github.com/GaryniL/ldid">Project Link</a></p>
<p><a href="https://github.com/GaryniL/ldid"><img loading="lazy" decoding="async" alt="Array" src="//i0.wp.com/lh6.googleusercontent.com/oEAPtGL4HQ1iq4EKW-VjfpSVeQoTkHU_O1yJZ0XB2kEcHWc6Y2Cmu-w7JqA" width="900" height="484" scale="2"></a></p>
<p></p><pre class="urvanov-syntax-highlighter-plain-tag">curl https://raw.githubusercontent.com/GaryniL/ldid/master/ldid2 -o ldid2
sudo mv ldid2 /usr/local/bin/
chmod +x /usr/local/bin/ldid2</pre><p></p>
<p>Then rebuild the project, it will work.<br />
<a href="//i0.wp.com/lh3.googleusercontent.com/HuX8tRwjS2qGOvuRaQdHHw-_knyoBynGLGWemba1jNcauklvrsOrW5DCj-o" data-featherlight="image"><img loading="lazy" decoding="async" alt="Array" src="//i0.wp.com/lh3.googleusercontent.com/HuX8tRwjS2qGOvuRaQdHHw-_knyoBynGLGWemba1jNcauklvrsOrW5DCj-o" width="900" height="153" scale="2"></a><br />
<a href="//i0.wp.com/lh5.googleusercontent.com/B-TmX8yOe6Sd9u0HcBPzLwY_AVToPvguK0r5819RkDfBZmFoLX07xlbJjLU" data-featherlight="image"><img loading="lazy" decoding="async" alt="Array" src="//i0.wp.com/lh5.googleusercontent.com/B-TmX8yOe6Sd9u0HcBPzLwY_AVToPvguK0r5819RkDfBZmFoLX07xlbJjLU" width="277" height="600" scale="2"></a></p>
<h2>Remove Anemone</h2>
<p>Besides, you can remove the line for preventing installing Anemone tweak<br />
<a href="//i1.wp.com/lh3.googleusercontent.com/zymV2cO9wQeooRedfMGl6ceHlGRq-4KacyFSn2O3ljX6fXM0Uk1_4Y19PC4" data-featherlight="image"><img loading="lazy" decoding="async" alt="Array" src="//i1.wp.com/lh3.googleusercontent.com/zymV2cO9wQeooRedfMGl6ceHlGRq-4KacyFSn2O3ljX6fXM0Uk1_4Y19PC4" width="900" height="590" scale="2"></a></p>
<p>這篇文章 <a rel="nofollow" href="https://garynil.tw/2018/01/691/tutorial-build-electra-ios-11-jailbreak-app-ldid2/">[Tutorial] How to build Electra ( iOS 11 Jailbreak app ) with ldid2</a> 最早出現於 <a rel="nofollow" href="https://garynil.tw">Gary&#039;s ...Lasamia</a>。</p>
]]></content:encoded>
					
					<wfw:commentRss>https://garynil.tw/2018/01/691/tutorial-build-electra-ios-11-jailbreak-app-ldid2/feed/</wfw:commentRss>
			<slash:comments>11</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">691</post-id>	</item>
		<item>
		<title>[Tutorial] Import IOKit framework into Xcode project</title>
		<link>https://garynil.tw/2017/01/298/tutorial-import-iokit-framework-into-xcode-project/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=tutorial-import-iokit-framework-into-xcode-project</link>
					<comments>https://garynil.tw/2017/01/298/tutorial-import-iokit-framework-into-xcode-project/#comments</comments>
		
		<dc:creator><![CDATA[Gary]]></dc:creator>
		<pubDate>Thu, 26 Jan 2017 18:44:03 +0000</pubDate>
				<category><![CDATA[Dev]]></category>
		<category><![CDATA[iOS]]></category>
		<category><![CDATA[framework]]></category>
		<category><![CDATA[IOKit]]></category>
		<category><![CDATA[Xcode]]></category>
		<category><![CDATA[Yalu]]></category>
		<guid isPermaLink="false">https://garynil.tw/?p=298</guid>

					<description><![CDATA[<p>While you&#8217;re developing iOS project on Xcode, you may need IOKit framework for some reason, such as get UDID of iDevice &#8230;etc, or using on Yalu&#8217;s project&#8230; The I/O Kit framework implements non-kernel access to I/O Kit objects (drivers and nubs) through the device-interface mechanism. So, in this article, I tried to write down how I import IOKit framework into a Xcode project....</p>
<p>這篇文章 <a rel="nofollow" href="https://garynil.tw/2017/01/298/tutorial-import-iokit-framework-into-xcode-project/">[Tutorial] Import IOKit framework into Xcode project</a> 最早出現於 <a rel="nofollow" href="https://garynil.tw">Gary&#039;s ...Lasamia</a>。</p>
]]></description>
										<content:encoded><![CDATA[<p>While you&#8217;re developing iOS project on Xcode, you may need IOKit framework for some reason, such as <a href="http://www.cnblogs.com/liyy2015/p/6090204.html" target="_blank">get UDID of iDevice</a> &#8230;etc, or using on <a href="https://garynil.tw/2017/01/295" target="_blank">Yalu&#8217;s project</a>&#8230;</p>
<p><citation>The I/O Kit framework implements non-kernel access to I/O Kit objects (drivers and nubs) through the device-interface mechanism.</citation></p>
<p>So, in this article, I tried to write down how I import IOKit framework into a Xcode project.</p>
<p>Things you need are：</p>
<ul>
<li>Xcode 8 (This sample was builded on Xcode version 8 in macOS 10.12)</li>
<li>iOS SDK (It should be installed with your Xcode)</li>
<li><a href="https://github.com/benjamin-42/Trident" target="_blank">Trident</a> &#8211; IOKit header files</li>
</ul>
<h3>Import Error</h3>
<p>When you try to use IOKit, for instance：<br />
<code>#import &lt;IOKit/IOKitLib.h&gt;</code></p>
<p>you may meet error like this：<br />
<a href="https://flic.kr/p/RkUc9q"><img data-recalc-dims="1" loading="lazy" decoding="async" src="https://i0.wp.com/farm1.staticflickr.com/746/32386678372_f82d859a17_z.jpg?resize=640%2C425&#038;ssl=1" alt="螢幕快照 2017-01-27 上午1.32.08" width="640" height="425" /></a></p>
<p><span id="more-298"></span></p>
<h3>Step 1：Import IOKit Framework</h3>
<p>Different from IOKit as a libraries on iOS 5, <a href="https://developer.apple.com/library/content/documentation/DeviceDrivers/Conceptual/IOKitFundamentals/Introduction/Introduction.html" target="_blank">Apple</a> change IOKit from library into framework on iOS 7.<br />
So first of all, we need to import the IOKit framework in Xcode.app into our project</p>
<p>if you try to type in your terminal<br />
<code>$ find /Applications/Xcode.app/ -name IOKit.framework</code><br />
you will find 5 different IOKit framework of 5 different platforms in Xcode.app<br />
<a href="https://flic.kr/p/QhPHhQ"><img data-recalc-dims="1" loading="lazy" decoding="async" src="https://i0.wp.com/farm1.staticflickr.com/667/31695497964_c298971de2_z.jpg?resize=640%2C495&#038;ssl=1" alt="螢幕快照_2017-01-27_上午1_42_38" width="640" height="495" /></a></p>
<p>We need &#8220;<em>iPhoneOS.platform</em>&#8221; recently, the path is：</p><pre class="urvanov-syntax-highlighter-plain-tag">/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/IOKit.framework</pre><p><a href="https://flic.kr/p/RzoiHB"><img data-recalc-dims="1" loading="lazy" decoding="async" src="https://i0.wp.com/farm1.staticflickr.com/702/32539278065_09c7ae89df_z.jpg?resize=640%2C396&#038;ssl=1" alt="螢幕快照_2017-01-27_上午1_45_25" width="640" height="396" /></a></p>
<p>Then go to application Target → General in Xcode project tab, and find &#8220;<em>Link Frameworks and Libraries</em>&#8220;.<br />
<a href="https://flic.kr/p/QhPHbC"><img data-recalc-dims="1" loading="lazy" decoding="async" src="https://i0.wp.com/farm1.staticflickr.com/496/31695497604_2600718c01_z.jpg?resize=640%2C364&#038;ssl=1" alt="螢幕快照_2017-01-27_上午1_49_33" width="640" height="364" /></a></p>
<p>Press the add button on the bottom left and use &#8220;<em>Add Other</em>&#8221; button to find the framework in the specific path.<br />
<a href="https://flic.kr/p/QhPHvq"><img data-recalc-dims="1" loading="lazy" decoding="async" src="https://i0.wp.com/farm1.staticflickr.com/680/31695498694_73e3f57dd2_z.jpg?resize=640%2C364&#038;ssl=1" alt="螢幕快照 2017-01-27 上午1.54.51" width="640" height="364" /></a></p>
<p>Find the IOKit.framework on the path I mentioned above and add it, after you finish it, it will show up in the area of &#8220;<em>Link Frameworks and Libraries</em>&#8221;</p>
<p>Also remember check if the IOKit.framework also shows up at the area of &#8220;<em>Link Binary with Libraries</em>&#8221; at application Target → Build Phases in Xcode project tab<br />
<a href="https://flic.kr/p/RzoiDZ"><img data-recalc-dims="1" loading="lazy" decoding="async" src="https://i0.wp.com/farm1.staticflickr.com/346/32539277855_ecf3a74c2f_z.jpg?resize=640%2C364&#038;ssl=1" alt="螢幕快照_2017-01-27_上午1_55_00" width="640" height="364" /></a></p>
<h3>Step 2：Add header files of IOKit</h3>
<p>I read some article on internet said that header files of IOKit framework will be at</p><pre class="urvanov-syntax-highlighter-plain-tag">Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/System/Library/Frameworks/IOKit.framework/Headers</pre><p>but I couldn&#8217;t find any header files in the path, so I tried another way.<br />
I use the header files in <a href="https://github.com/benjamin-42/Trident" target="_blank">Trident</a> and add it to my project.<br />
First, download it form GitHub, what we need is a folder in it <code>Trident-master/Headers/IOKit</code> called IOKit<br />
<a href="https://flic.kr/p/RkUbPh"><img data-recalc-dims="1" loading="lazy" decoding="async" src="https://i0.wp.com/farm1.staticflickr.com/363/32386677262_71be98136d_z.jpg?resize=640%2C327&#038;ssl=1" alt="螢幕快照_2017-01-27_上午2_01_45" width="640" height="327" /></a></p>
<p>Copy the IOKit folder to $(SRCROOT) &#8211; the path to the directory containing your Xcode project<br />
<a href="https://flic.kr/p/QhQ2zw"><img data-recalc-dims="1" loading="lazy" decoding="async" src="https://i0.wp.com/farm1.staticflickr.com/566/31695559484_917c7d9dd0_z.jpg?resize=640%2C327&#038;ssl=1" alt="螢幕快照_2017-01-27_上午2_02_05" width="640" height="327" /></a></p>
<p><a href="https://flic.kr/p/RzoizF"><img data-recalc-dims="1" loading="lazy" decoding="async" src="https://i0.wp.com/farm1.staticflickr.com/658/32539277605_84c0909ec7_z.jpg?resize=640%2C347&#038;ssl=1" alt="螢幕快照_2017-01-27_上午2_11_45" width="640" height="347" /></a><br />
Then link the folder to your project, drag the folder to the project&#8217;s &#8220;Groups &amp; Files&#8221; area</p>
<p><a href="https://flic.kr/p/RzoiKv"><img data-recalc-dims="1" loading="lazy" decoding="async" src="https://i0.wp.com/farm1.staticflickr.com/770/32539278175_44154a11d6_z.jpg?resize=640%2C364&#038;ssl=1" alt="螢幕快照 2017-01-27 上午2.13.46" width="640" height="364" /></a></p>
<h3>Step 3：Make Xcode find header files you added</h3>
<p>Go to application Target → Build Setting in Xcode project tab, and search &#8220;<code2>Header Search Paths</code2>&#8221; by search bar on the top right of navigator.<br />
<a href="https://flic.kr/p/RkWqf1"><img data-recalc-dims="1" loading="lazy" decoding="async" src="https://i0.wp.com/farm1.staticflickr.com/278/32387112652_b665723ba9_z.jpg?resize=640%2C364&#038;ssl=1" alt="螢幕快照_2017-01-27_上午2_31_26" width="640" height="364" /></a></p>
<p>and add <code>$(SRCROOT)</code> into the item, remember change the option to &#8220;recursive&#8221;<br />
<a href="https://flic.kr/p/RozLaz"><img data-recalc-dims="1" loading="lazy" decoding="async" src="https://i0.wp.com/farm1.staticflickr.com/473/32417031811_b96b2c0c71_z.jpg?resize=640%2C429&#038;ssl=1" alt="螢幕快照 2017-01-27 上午2.50.58" width="640" height="429" /></a></p>
<p>Then it done.<br />
Remember to clean your project (CMD+SHIFT+K) and build it again</p>
<p>這篇文章 <a rel="nofollow" href="https://garynil.tw/2017/01/298/tutorial-import-iokit-framework-into-xcode-project/">[Tutorial] Import IOKit framework into Xcode project</a> 最早出現於 <a rel="nofollow" href="https://garynil.tw">Gary&#039;s ...Lasamia</a>。</p>
]]></content:encoded>
					
					<wfw:commentRss>https://garynil.tw/2017/01/298/tutorial-import-iokit-framework-into-xcode-project/feed/</wfw:commentRss>
			<slash:comments>6</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">298</post-id>	</item>
		<item>
		<title>iOS 9 App Transport Security 設定</title>
		<link>https://garynil.tw/2015/10/40/ios-9-app-transport-security-%e8%a8%ad%e5%ae%9a/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=ios-9-app-transport-security-%25e8%25a8%25ad%25e5%25ae%259a</link>
					<comments>https://garynil.tw/2015/10/40/ios-9-app-transport-security-%e8%a8%ad%e5%ae%9a/#respond</comments>
		
		<dc:creator><![CDATA[Gary]]></dc:creator>
		<pubDate>Mon, 05 Oct 2015 14:01:18 +0000</pubDate>
				<category><![CDATA[Dev]]></category>
		<category><![CDATA[iOS]]></category>
		<category><![CDATA[App]]></category>
		<category><![CDATA[Xcode]]></category>
		<guid isPermaLink="false">https://garynil1635.wordpress.com/?p=40</guid>

					<description><![CDATA[<p>最近因為OS X更新到了10.11，也將Xcode隨著更新到了第7版 剛好要改一個舊的Project，在連線功能卻出現了這個問題： [crayon-6a782945c3ab5618865950/] 查了一下Document才知道 Apple在 WWDC 2015改變了一些東西：&#8220;What&#8217;s New in iOS 9&#8221; App Transport Security App Transport Security (ATS) enforces best practices in the secure connections between an app and its back end. ATS prevents accidental disclosure, provides secure default behavior, and is easy to a...</p>
<p>這篇文章 <a rel="nofollow" href="https://garynil.tw/2015/10/40/ios-9-app-transport-security-%e8%a8%ad%e5%ae%9a/">iOS 9 App Transport Security 設定</a> 最早出現於 <a rel="nofollow" href="https://garynil.tw">Gary&#039;s ...Lasamia</a>。</p>
]]></description>
										<content:encoded><![CDATA[<p>最近因為OS X更新到了10.11，也將Xcode隨著更新到了第7版<br />
剛好要改一個舊的Project，在連線功能卻出現了這個問題：</p><pre class="urvanov-syntax-highlighter-plain-tag">The resource could not be loaded because the App Transport 
Security policy requires the use of a secure connection</pre><p><img decoding="async" src="https://farm1.staticflickr.com/594/21780179060_8463a49233_h.jpg[" alt="" /></p>
<p>查了一下Document才知道 Apple在 WWDC 2015改變了一些東西：<a href="https://developer.apple.com/library/prerelease/ios/releasenotes/General/WhatsNewIniOS/Articles/iOS9.html#//apple_ref/doc/uid/TP40016198-SW1" target="_blank">&#8220;What&#8217;s New in iOS 9&#8221;</a></p>
<p><span id="more-40"></span></p>
<h3 class="jump"></h3>
<h3 class="jump">App Transport Security</h3>
<p><em>App Transport Security (ATS) enforces best practices in the secure connections between an app and its back end. ATS prevents accidental disclosure, provides secure default behavior, and is easy to adopt; it is also on by default in iOS 9 and OS X v10.11. You should adopt ATS as soon as possible, regardless of whether you’re creating a new app or updating an existing one.</em></p>
<p><em>If you’re developing a new app, you should use HTTPS exclusively. If you have an existing app, you should use HTTPS as much as you can right now, and create a plan for migrating the rest of your app as soon as possible. In addition, your communication through higher-level APIs needs to be encrypted using TLS version 1.2 with forward secrecy. If you try to make a connection that doesn&#8217;t follow this requirement, an error is thrown. If your app needs to make a request to an insecure domain, you have to specify this domain in your app&#8217;s <code>Info.plist</code> file</em></p>
<p>簡單來說就是Apple因為安全性建議大家使用Https取代Http，未來版本不確定是否會強制規定使用Https，但目前可以以修改info.plist的方式來恢復舊有的方法。</p>
<p><strong style="color: red;">當然可以使用ATS當然是最好的，也是更安全的方式！</strong><br />
<code></code></p>
<p>而解決方法則是，在專案的info.plist加入以下的值：</p><pre class="urvanov-syntax-highlighter-plain-tag">&amp;lt;key&amp;gt;NSAppTransportSecurity&amp;lt;/key&amp;gt;
&amp;lt;dict&amp;gt;
  &amp;lt;key&amp;gt;NSExceptionDomains&amp;lt;/key&amp;gt;
  &amp;lt;dict&amp;gt;
    &amp;lt;key&amp;gt;你的域名或主機&amp;lt;/key&amp;gt;
    &amp;lt;dict&amp;gt;
      &amp;lt;!--Include to allow subdomains--&amp;gt;
      &amp;lt;key&amp;gt;NSIncludesSubdomains&amp;lt;/key&amp;gt;
      &amp;lt;true/&amp;gt;
      &amp;lt;!--Include to allow HTTP requests--&amp;gt;
      &amp;lt;key&amp;gt;NSTemporaryExceptionAllowsInsecureHTTPLoads&amp;lt;/key&amp;gt;
      &amp;lt;true/&amp;gt;
      &amp;lt;!--Include to specify minimum TLS version--&amp;gt;
      &amp;lt;key&amp;gt;NSTemporaryExceptionMinimumTLSVersion&amp;lt;/key&amp;gt;
      &amp;lt;string&amp;gt;TLSv1.1&amp;lt;/string&amp;gt;
    &amp;lt;/dict&amp;gt;
  &amp;lt;/dict&amp;gt;
&amp;lt;/dict&amp;gt;</pre><p>當然也會出現你沒辦法決定對哪些網址你要開放的狀況..<br />
那就如下面這樣全部開放：<br />
<code></code></p><pre class="urvanov-syntax-highlighter-plain-tag">&amp;lt;key&amp;gt;NSAppTransportSecurity&amp;lt;/key&amp;gt;
&amp;lt;dict&amp;gt;
  &amp;lt;!--Include to allow all connections (DANGER)--&amp;gt;
  &amp;lt;key&amp;gt;NSAllowsArbitraryLoads&amp;lt;/key&amp;gt;
      &amp;lt;true/&amp;gt;
&amp;lt;/dict&amp;gt;</pre><p>大致上這樣就可以正常使用了～<br />
當然比較安全也根本的方法是改變成 Https&#8230;</p>
<p>這篇文章 <a rel="nofollow" href="https://garynil.tw/2015/10/40/ios-9-app-transport-security-%e8%a8%ad%e5%ae%9a/">iOS 9 App Transport Security 設定</a> 最早出現於 <a rel="nofollow" href="https://garynil.tw">Gary&#039;s ...Lasamia</a>。</p>
]]></content:encoded>
					
					<wfw:commentRss>https://garynil.tw/2015/10/40/ios-9-app-transport-security-%e8%a8%ad%e5%ae%9a/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">40</post-id>	</item>
	</channel>
</rss>
