<?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>iOS &#8211; 编程技术记录</title>
	<atom:link href="https://blog.z6z8.cn/tag/ios/feed/" rel="self" type="application/rss+xml" />
	<link>https://blog.z6z8.cn</link>
	<description>世界你好!</description>
	<lastBuildDate>Fri, 30 Jul 2021 07:48:02 +0000</lastBuildDate>
	<language>zh-Hans</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.8.3</generator>
	<item>
		<title>Xcode调试iPhone真机 ：code signature version is no longer supported</title>
		<link>https://blog.z6z8.cn/2021/07/30/xcode%e8%b0%83%e8%af%95iphone%e7%9c%9f%e6%9c%ba-%ef%bc%9acode-signature-version-is-no-longer-supported/</link>
		
		<dc:creator><![CDATA[holdsky]]></dc:creator>
		<pubDate>Fri, 30 Jul 2021 07:48:02 +0000</pubDate>
				<category><![CDATA[iOS]]></category>
		<guid isPermaLink="false">http://blog.z6z8.cn/?p=1073</guid>

					<description><![CDATA[Details Unable to install "MyApp" Domain: com.apple.dt. [&#8230;]]]></description>
										<content:encoded><![CDATA[<pre><code>Details

Unable to install "MyApp"
Domain: com.apple.dt.MobileDeviceErrorDomain
Code: -402620375
-

The code signature version is no longer supported.
Domain: com.apple.dt.MobileDeviceErrorDomain
Code: -402620375
User Info: {
  DVTRadarComponentKey = 261622;
  MobileDeviceErrorCode = "(0xE8008029)";
  "com.apple.dtdevicekit.stacktrace" = (
0  DTDeviceKitBase           0x000000011edd83b8 DTDKCreateNSErrorFromAMDErrorCode + 220
1  DTDeviceKitBase           0x000000011ee16ae1 __90-[DTDKMobileDeviceToken installApplicationBundleAtPath:withOptions:andError:withCallback:]_block_invoke + 155
2  DVTFoundation            0x0000000107881b7c DVTInvokeWithStrongOwnership + 71
3  DTDeviceKitBase           0x000000011ee16822 -[DTDKMobileDeviceToken installApplicationBundleAtPath:withOptions:andError:withCallback:] + 1440
4  IDEiOSSupportCore          0x000000011eccf999 __118-[DVTiOSDevice(DVTiPhoneApplicationInstallation) processAppInstallSet:appUninstallSet:installOptions:completionBlock:]_block_invoke.294 + 3534
5  DVTFoundation            0x00000001079b4931 __DVT_CALLING_CLIENT_BLOCK__ + 7
6  DVTFoundation            0x00000001079b655b __DVTDispatchAsync_block_invoke + 1191
7  libdispatch.dylib          0x00007fff20508603 _dispatch_call_block_and_release + 12
8  libdispatch.dylib          0x00007fff205097e6 _dispatch_client_callout + 8
9  libdispatch.dylib          0x00007fff2050f5ca _dispatch_lane_serial_drain + 606
10 libdispatch.dylib          0x00007fff2051008d _dispatch_lane_invoke + 366
11 libdispatch.dylib          0x00007fff20519bed _dispatch_workloop_worker_thread + 811
12 libsystem_pthread.dylib       0x00007fff206b04c0 _pthread_wqthread + 314
13 libsystem_pthread.dylib       0x00007fff206af493 start_wqthread + 15
);
}
-</code></pre>
<p>可能是因为对framework的签名不一致导致，有的是<code>Do Not Embed</code>, 有的是<code>Embed and Sign</code></p>
<p>可能的解决办法：<br />
App 的TARGETS -&gt; General -&gt; Frameworks,Libraries,and EmbeddedContent -&gt; 将<code>Embed and Sign</code>修改为 <code>Do Not Embed</code>。</p>
<p><a href="https://developer.apple.com/forums/thread/679182">https://developer.apple.com/forums/thread/679182</a></p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>iOS 诡异的崩溃EXC_BREAKPOINT (code=1, subcode=0x1c5691d2c)</title>
		<link>https://blog.z6z8.cn/2020/03/10/ios-%e8%af%a1%e5%bc%82%e7%9a%84%e5%b4%a9%e6%ba%83exc_breakpoint-code1-subcode0x1c5691d2c/</link>
		
		<dc:creator><![CDATA[holdsky]]></dc:creator>
		<pubDate>Tue, 10 Mar 2020 15:39:28 +0000</pubDate>
				<category><![CDATA[iOS]]></category>
		<category><![CDATA[学习笔记]]></category>
		<guid isPermaLink="false">http://blog.z6z8.cn/?p=823</guid>

					<description><![CDATA[系统 : iOS 13.3.1 机型： iPhone7 dispatch_async(_jsContextQu [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>系统 : iOS 13.3.1<br />
机型： iPhone7</p>
<p><img decoding="async" src="/wp-content/uploads/2020/03/jscore_uiwebview_crash.png" alt="" /></p>
<pre><code class="language-objc">  dispatch_async(_jsContextQueue, ^{
        JSContext *jscontent = [[JSContext alloc] init];
        [UIWebView class];
    });</code></pre>
<p>看代码，按照正常思维理解， [UIWebView class]是无论如何都不应崩溃的。</p>
<p>起初按照惯性思维去查找僵尸变量，忙活了半天没有定位。<br />
最终定位结果如下：<br />
<code>在没有调用过UIWebView的任何函数时，先在非主线程调用UIWebView方法，则会导致崩溃</code></p>
<p>本文的相关代码如下</p>
<pre><code class="language-objc">#import "ViewController.h"
#import &lt;JavaScriptCore/JavaScriptCore.h&gt;

@interface ViewController ()&lt;UITableViewDelegate,UITableViewDataSource&gt;
{
    dispatch_queue_t _jsContextQueue;
}
@end

@implementation ViewController

- (void)viewDidLoad
{
    [super viewDidLoad];
    _jsContextQueue = dispatch_queue_create("jscontext", NULL);
    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
        dispatch_async(_jsContextQueue, ^{
            JSContext *jscontent = [[JSContext alloc] init];
            [UIWebView class];
        });
    });
}
@end
</code></pre>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>WKWebView ： html的input控件的onfocus事件被触发了两次</title>
		<link>https://blog.z6z8.cn/2020/02/11/html%e7%9a%84input%e6%8e%a7%e4%bb%b6%e7%9a%84onfocus%e4%ba%8b%e4%bb%b6%e8%a2%ab%e8%a7%a6%e5%8f%91%e4%ba%86%e4%b8%a4%e6%ac%a1/</link>
		
		<dc:creator><![CDATA[holdsky]]></dc:creator>
		<pubDate>Tue, 11 Feb 2020 08:47:54 +0000</pubDate>
				<category><![CDATA[iOS]]></category>
		<category><![CDATA[学习笔记]]></category>
		<category><![CDATA[WKWebView]]></category>
		<guid isPermaLink="false">http://blog.z6z8.cn/?p=791</guid>

					<description><![CDATA[环境: iOS 13.2 + WKWebView 现象一： 当不添加viewport时,onfocus被触发一 [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>环境:</p>
<ul>
<li>iOS 13.2  + WKWebView</li>
</ul>
<p>现象一：<br />
当不添加<code>viewport</code>时,onfocus被触发一次</p>
<pre><code class="language-html">&lt;!DOCTYPE html&gt;
&lt;html&gt;
    &lt;head&gt;
        &lt;script&gt;
            function onfocus123(e){
                console.log(456);
            }
        &lt;/script&gt;
    &lt;/head&gt;
    &lt;body&gt;
        &lt;span&gt;test_input&lt;/span&gt;
        &lt;input id="test_input" type="text" onfocus="onfocus123(event)"&gt;
    &lt;/body&gt;
&lt;/html&gt;</code></pre>
<table>
<thead>
<tr>
<th>第一次点击input输入框</th>
<th>第二次点击input输入框</th>
</tr>
</thead>
<tbody>
<tr>
<td>输出：456</td>
<td>输出: 456</td>
</tr>
</tbody>
</table>
<p>现象一：<br />
当添加<code>viewport</code>时,onfocus被触发两次</p>
<pre><code class="language-html">&lt;!DOCTYPE html&gt;
&lt;html&gt;
    &lt;head&gt;
        &lt;script&gt;
            function onfocus123(e){
                console.log(456);
            }
        &lt;/script&gt;
        &lt;meta name="viewport" content="width=device-width, initial-scale=1.0,maximum-scale=1.0, minimum-scale=1.0, viewport-fit=cover,user-scalable=no"&gt;
    &lt;/head&gt;
    &lt;body&gt;
        &lt;span&gt;test_input&lt;/span&gt;
        &lt;input id="test_input" type="text" onfocus="onfocus123(event)"&gt;
    &lt;/body&gt;
&lt;/html&gt;</code></pre>
<table>
<thead>
<tr>
<th>第一次点击input输入框</th>
<th>第二次点击input输入框</th>
</tr>
</thead>
<tbody>
<tr>
<td>输出：456  456</td>
<td>输出: 456</td>
</tr>
</tbody>
</table>
<p>暂时没有比较好的解决办法。</p>
<p>另，参考https://patrickhlauke.github.io/touch/tests/results/，</p>
<pre><code>There is some oddity/bug in iOS 12.2, with ,  and  being fired twice when first tapping on the control. The experimental WebKit feature for pointer events also generates some duplicate pointerup events.</code></pre>
<p>可知，基于WebKit的浏览器如WKWebView,Safari，在一些版本上（如12.2）会有奇怪的bug,事件<code>mousedown</code>、<code>mouseup</code>、<code>click</code>在第一次进入控件时会被触发两次。</p>
<p>其他相关讨论可见https://greensock.com/forums/topic/21397-ios-13-safariwkwebview-draggable-double-dispatching-click-events/</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Objective-C:动态创建新类（Class）</title>
		<link>https://blog.z6z8.cn/2019/11/29/objective-c%e5%8a%a8%e6%80%81%e5%88%9b%e5%bb%ba%e6%96%b0%e7%b1%bb%ef%bc%88class%ef%bc%89/</link>
					<comments>https://blog.z6z8.cn/2019/11/29/objective-c%e5%8a%a8%e6%80%81%e5%88%9b%e5%bb%ba%e6%96%b0%e7%b1%bb%ef%bc%88class%ef%bc%89/#respond</comments>
		
		<dc:creator><![CDATA[holdsky]]></dc:creator>
		<pubDate>Fri, 29 Nov 2019 03:10:40 +0000</pubDate>
				<category><![CDATA[Objective-C]]></category>
		<category><![CDATA[代码片段]]></category>
		<category><![CDATA[iOS]]></category>
		<guid isPermaLink="false">http://blog.z6z8.cn/?p=592</guid>

					<description><![CDATA[动态创建一个类，NewClass ，继承自NSObject Class newClass = objc_all [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>动态创建一个类，NewClass ，继承自NSObject</p>
<pre><code class="language-objc">Class newClass = objc_allocateClassPair([NSObject class], "NewClass", 0);

//向运行时注册这个类
objc_registerClassPair(newClass);

//从运行时销毁这个类
objc_disposeClassPair(newClass);</code></pre>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.z6z8.cn/2019/11/29/objective-c%e5%8a%a8%e6%80%81%e5%88%9b%e5%bb%ba%e6%96%b0%e7%b1%bb%ef%bc%88class%ef%bc%89/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Could not signal service com.apple.WebKit.WebContent: 113: Could not find specified service</title>
		<link>https://blog.z6z8.cn/2019/11/07/could-not-signal-service-com-apple-webkit-webcontent-113-could-not-find-specified-service/</link>
					<comments>https://blog.z6z8.cn/2019/11/07/could-not-signal-service-com-apple-webkit-webcontent-113-could-not-find-specified-service/#respond</comments>
		
		<dc:creator><![CDATA[holdsky]]></dc:creator>
		<pubDate>Thu, 07 Nov 2019 07:18:27 +0000</pubDate>
				<category><![CDATA[iOS]]></category>
		<category><![CDATA[学习笔记]]></category>
		<category><![CDATA[WKWebView]]></category>
		<guid isPermaLink="false">http://blog.z6z8.cn/?p=547</guid>

					<description><![CDATA[接手一个项目，Debug运行后打开WKWebView的页面，Xcode报出日志 Could not signa [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>接手一个项目，Debug运行后打开WKWebView的页面，Xcode报出日志</p>
<pre><code>Could not signal service com.apple.WebKit.WebContent: 113: Could not find specified service</code></pre>
<p>解决办法：<br />
<code>在WKWebView在Window上显示之前，不要加载网页</code><br />
直白的代码如下：</p>
<pre><code class="language-objc">[self.view addSubView:wkwebView];
[wkwebView loadRequest:request]</code></pre>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.z6z8.cn/2019/11/07/could-not-signal-service-com-apple-webkit-webcontent-113-could-not-find-specified-service/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>WKWebView：适配H5页面的显示尺寸</title>
		<link>https://blog.z6z8.cn/2019/11/04/wkwebview%ef%bc%9a%e9%80%82%e9%85%8dh5%e9%a1%b5%e9%9d%a2%e7%9a%84%e6%98%be%e7%a4%ba%e5%b0%ba%e5%af%b8/</link>
					<comments>https://blog.z6z8.cn/2019/11/04/wkwebview%ef%bc%9a%e9%80%82%e9%85%8dh5%e9%a1%b5%e9%9d%a2%e7%9a%84%e6%98%be%e7%a4%ba%e5%b0%ba%e5%af%b8/#respond</comments>
		
		<dc:creator><![CDATA[holdsky]]></dc:creator>
		<pubDate>Mon, 04 Nov 2019 03:29:01 +0000</pubDate>
				<category><![CDATA[iOS]]></category>
		<category><![CDATA[学习笔记]]></category>
		<category><![CDATA[布局]]></category>
		<category><![CDATA[WKWebView]]></category>
		<guid isPermaLink="false">http://blog.z6z8.cn/?p=544</guid>

					<description><![CDATA[一般的同样的html代码，在UIWebView和WKWebView中显示效果是不一样的。例如 &#60;!DOC [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>一般的同样的html代码，在UIWebView和WKWebView中显示效果是不一样的。例如</p>
<pre><code class="language-html">&lt;!DOCTYPE html&gt;
&lt;html&gt;
    &lt;body&gt;
        &lt;span&gt;test_input&lt;/span&gt;
        &lt;input id="test_input" type="text"&gt;
    &lt;/body&gt;
&lt;/html&gt;</code></pre>
<p>显示效果：<img decoding="async" src="/wp-content/uploads/2019/11/wkwebview_uiwebview.png" alt="" /></p>
<p>可以看出两者有明显的区别。<br />
那么如何适配呢？有两个方法（本质上是一个）。<br />
1、如果是H5适配WKWebView的话，需要在H5添加如下代码</p>
<pre><code class="language-html">&lt;meta name="viewport" content="width=device-width"&gt;</code></pre>
<p>完整的html如下</p>
<pre><code class="language-html">&lt;!DOCTYPE html&gt;
&lt;html&gt;
    &lt;head&gt;
        &lt;meta name="viewport" content="width=device-width"&gt;
    &lt;/head&gt;
    &lt;body&gt;
        &lt;span&gt;test_input&lt;/span&gt;
        &lt;input id="test_input" type="text"&gt;
    &lt;/body&gt;
&lt;/html&gt;</code></pre>
<p>2、如果是WKWebView适配H5的话，那么就需要替前端添加相同的H5代码，实现如下</p>
<pre><code class="language-swift"> //js代码，在文档加载完毕后，添加head的子节点
 //节点内容为&lt;meta name="viewport" content="width=device-width"&gt;
        let jScript = "var meta = document.createElement('meta'); meta.setAttribute('name', 'viewport'); meta.setAttribute('content', 'width=device-width'); document.getElementsByTagName('head')[0].appendChild(meta);";
        let wkUScript = WKUserScript.init(source: jScript, injectionTime: WKUserScriptInjectionTime.atDocumentEnd, forMainFrameOnly: true);
        let wkUController = WKUserContentController.init();
        wkUController.addUserScript(wkUScript);

        let wkconfig = WKWebViewConfiguration.init();
        wkconfig.userContentController = wkUController;

        _webView = WKWebView.init(frame: CGRect.init(x: 0, y: 0, width: self.view.bounds.size.width, height: self.view.bounds.size.height), configuration: wkconfig);
        self.view.addSubview(_webView);

        let htmlfile = Bundle.main.path(forResource: "test", ofType: ".html");
        let url = URL.init(fileURLWithPath: htmlfile!);
        let request = URLRequest.init(url: url);
        _webView.load(request);</code></pre>
<p>参考 <a href="https://blog.csdn.net/GYMotgm/article/details/77944163">https://blog.csdn.net/GYMotgm/article/details/77944163</a></p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.z6z8.cn/2019/11/04/wkwebview%ef%bc%9a%e9%80%82%e9%85%8dh5%e9%a1%b5%e9%9d%a2%e7%9a%84%e6%98%be%e7%a4%ba%e5%b0%ba%e5%af%b8/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>iOS xcodebuild自动构建常用命令</title>
		<link>https://blog.z6z8.cn/2019/10/30/ios-xcodebuild%e8%87%aa%e5%8a%a8%e6%9e%84%e5%bb%ba%e5%b8%b8%e7%94%a8%e5%91%bd%e4%bb%a4/</link>
					<comments>https://blog.z6z8.cn/2019/10/30/ios-xcodebuild%e8%87%aa%e5%8a%a8%e6%9e%84%e5%bb%ba%e5%b8%b8%e7%94%a8%e5%91%bd%e4%bb%a4/#respond</comments>
		
		<dc:creator><![CDATA[holdsky]]></dc:creator>
		<pubDate>Wed, 30 Oct 2019 02:17:27 +0000</pubDate>
				<category><![CDATA[iOS]]></category>
		<category><![CDATA[学习笔记]]></category>
		<category><![CDATA[xcodebuild]]></category>
		<guid isPermaLink="false">http://blog.z6z8.cn/?p=537</guid>

					<description><![CDATA[列出工作空间中的所有scheme xcodebuild -list -workspace abc.xcwork [&#8230;]]]></description>
										<content:encoded><![CDATA[<h1>列出工作空间中的所有scheme</h1>
<pre><code class="language-shell">xcodebuild -list -workspace abc.xcworkspace

输出
Information about workspace "abc":
    Schemes:
            abc
        AFNetworking
        FMDB
        GTMBase64
        Minizip
        Pods-abc</code></pre>
<h1>列出项目的所有target及Configurations</h1>
<pre><code class="language-shell">xcodebuild -list -project abc.xcodeproj

输出
Information about project "abc":
    Targets:
        abc

    Build Configurations:
        Debug
        Release

    If no build configuration is specified and -scheme is not passed then "Release" is used.

    Schemes:
        abc</code></pre>
<h1>编译指定的scheme或Target</h1>
<h2>指定scheme</h2>
<pre><code class="language-shell">xcodebuild -workspace abc.xcworkspace -scheme test

或者

xcodebuild -project abc.xcodeproj -scheme test</code></pre>
<p>此时默认编译<code>Release</code>版</p>
<h2>指定target</h2>
<pre><code class="language-shell">xcodebuild -project abc.xcodeproj -target test</code></pre>
<h2>指定 configuration</h2>
<pre><code class="language-shell">xcodebuild -workspace abc.xcworkspace -scheme test -configuration Debug</code></pre>
<p>此时编译<code>Debug</code>版</p>
<h2>指定编译依赖的sdk环境</h2>
<pre><code class="language-shell">xcodebuild -workspace abc.xcworkspace -scheme test -configuration Debug -sdk iphoneos</code></pre>
<p>将使用名字为<code>iphoneos</code>（真机版）的sdk环境编译，同样的<code>-sdk iphonesimulator</code>指定编译模拟器版本</p>
<blockquote>
<p>需要注意的，当不指定<code>-sdk</code>参数时，xcodebuild的某些版本会同时构建mac ,iPhone, iPad对应的版本</p>
</blockquote>
<h2>指定编译输出产物的目录</h2>
<p><code>BUILD_DIR</code>，在自动打包时很有用</p>
<pre><code class="language-shell">xcodebuild -workspace abc.xcworkspace -scheme test -configuration Debug -sdk iphoneos BUILD_DIR=/a/b/c/d/e</code></pre>
<h2>指定Xcode支持的其他配置</h2>
<p>以bitcode为例，设置键<code>ENABLE_BITCODE</code>的值：</p>
<pre><code class="language-shell">xcodebuild -workspace abc.xcworkspace -scheme test ENABLE_BITCODE=NO</code></pre>
<p>其他配置的键需要打开xcode的具体项目配置文件自行寻找</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.z6z8.cn/2019/10/30/ios-xcodebuild%e8%87%aa%e5%8a%a8%e6%9e%84%e5%bb%ba%e5%b8%b8%e7%94%a8%e5%91%bd%e4%bb%a4/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
