菜鸟教程小白 发表于 2022-12-11 18:12:41

ios - UrbanAirShip 集成在我的项目中。它在 Swift3 中运行不佳


                                            <p><p>我创建了一个新的 <code>urbanairship</code> 帐户,并按照 <a href="https://docs.urbanairship.com/platform/ios/?swift#sdk-installation" rel="noreferrer noopener nofollow">their link</a> 中所述的所有文档进行操作。但是当我像他们提到的那样设置 <code>AppDelegate</code> 部分时:</p>

<pre><code>func application(_ application: UIApplication,
               didFinishLaunchingWithOptions launchOptions: ?) -&gt; Bool {

    let config = UAConfig.default();
    UAirship.takeOff(config);
    UAirship.push().defaultPresentationOptions = [.alert, .badge, .sound]
    UAirship.push().userPushNotificationsEnabled = true;
    return true;
}
</code></pre>

<p>我的代码在 <code>UAirship.push().defaultPresentationOptions = [.alert, .badge, .sound]</code> 上崩溃说:<code> fatal error :在展开可选值时意外发现 nil。</code> </p>

<p>我调试并发现 <code>UAirship.push()</code> 导致结果为零。 </p>

<p>还请注意,我已按照同一页面上的要求创建了 <code>AirshipConfig.pList</code> 文件,并粘贴了以下内容:</p>

<pre><code>&lt;plist version=&#34;1.0&#34;&gt;
&lt;dict&gt;
    &lt;key&gt;developmentAppKey&lt;/key&gt;
    &lt;string&gt;Your Development App Key&lt;/string&gt;
    &lt;key&gt;developmentAppSecret&lt;/key&gt;
    &lt;string&gt;Your Development App Secret&lt;/string&gt;
    &lt;key&gt;productionAppKey&lt;/key&gt;
    &lt;string&gt;Your Production App Key&lt;/string&gt;
    &lt;key&gt;productionAppSecret&lt;/key&gt;
    &lt;string&gt;Your Production App Secret&lt;/string&gt;
    &lt;key&gt;useWKWebView&lt;/key&gt;
    &lt;true/&gt;
&lt;/dict&gt;
</code></pre>

<p></p>

<p>谁能告诉我我在这里做错了什么?</p></p>
                                    <br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
                                            <p><p>useWKWebView 好像早就失效了:</p>

<blockquote>
<p>2018-12-11 15:32:10.228876+0300 V4 P97 Dev
- Ignoring invalid UAConfig key: useWKWebView</p>
</blockquote>

<p>可能默认情况下它是打开的,虽然你不能通过字体的大小来判断
在那个 <code>WKWebView</code> ;^)</p></p>
                                   
                                                <p style="font-size: 20px;">关于ios - UrbanAirShip 集成在我的项目中。它在 Swift3 中运行不佳,我们在Stack Overflow上找到一个类似的问题:
                                                        <a href="https://stackoverflow.com/questions/44974325/" rel="noreferrer noopener nofollow" style="color: red;">
                                                                https://stackoverflow.com/questions/44974325/
                                                        </a>
                                                </p>
                                       
页: [1]
查看完整版本: ios - UrbanAirShip 集成在我的项目中。它在 Swift3 中运行不佳