www.91084.com

GVKun编程网logo

java – MDM – APNS无法正常工作(java.io.ioexception map failed)

25

在这篇文章中,我们将为您详细介绍java–MDM–APNS无法正常工作的内容,并且讨论关于java.io.ioexceptionmapfailed的相关问题。此外,我们还会涉及一些关于APK发行后,A

在这篇文章中,我们将为您详细介绍java – MDM – APNS无法正常工作的内容,并且讨论关于java.io.ioexception map failed的相关问题。此外,我们还会涉及一些关于APK发行后,Android Google Maps无法正常工作、APNS PHP推送通知无法正常工作.得到超时、c# – 带模板的EPPlus无法正常工作、CORS无法正常工作的PHP的知识,以帮助您更全面地了解这个主题。

本文目录一览:

java – MDM – APNS无法正常工作(java.io.ioexception map failed)

java – MDM – APNS无法正常工作(java.io.ioexception map failed)

我们正在内部实施MDM解决方案.我们已注册为MDM供应商,并按照此 site的步骤获得最终的APNS证书.我们还在设备中安装了MDM配置文件,该配置文件指向我们的后端服务器,该服务器能够接收/发送有效负载到设备.

然后我们使用java-apns库发送样本通知.下面是相同的示例代码.

ApnsService service =
            APNS.newService()
            .withCert("test.p12","xxxxxxx")
            .withProductionDestination()
            .build();
    String pushMagic = "xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx";

    String mdmPayload = APNS.newPayload().mdm(pushMagic).build();
    service.push(pushMagic,mdmPayload);

以上执行成功完成.但设备不会收到任何通知.有人可以对此有所了解吗?提前致谢.

更新:
在我们的实施中发现了几个问题. push API获取设备令牌和有效负载.我们在push API中错误地使用pushmagic作为标记.此外,设备在初始登记期间以base64格式发送设备令牌.因此需要将其转换为hexa格式并在push API中使用.

通过这两项变革,我们领先一步.现在反馈服务正在返回一条消息,指出相应的设备处于非活动状态.我们尝试重新安装配置文件并使用最新的推送魔术和设备令牌. Still Feedback服务返回相同的消息.

解决方法

如果您仍然面临此问题,请非常小心地遵循 MDM_Protocol.首先尝试使用生产APNS.

如果有任何其他问题提供问题详情.

APK发行后,Android Google Maps无法正常工作

APK发行后,Android Google Maps无法正常工作

我有包含Google Maps的Android应用程序发行该应用程序之前运行良好,但未显示地图.
尽管我已在发布后从Google控制台添加了SHA-1证书指纹,并将其添加到重新调整的应用中

SHA-1 after releasing

API Key Restrictions

因此,软件包名称中包含2个SHA-1,当直接从android studio中运行应用程序时,地图可以正常工作,但是从playstore下载应用程序时,它什么也没显示?

解决方法:

这是因为Google Play正在使用不同的SHA-1指纹对应用进行签名,因此您需要使用它并在Google开发者控制台中进行注册

enter image description here

APNS PHP推送通知无法正常工作.得到超时

APNS PHP推送通知无法正常工作.得到超时

我正在尝试在生产环境上发送推送通知,但它无法正常工作.下面是我正在尝试的代码,它会超时.没有错误,没有异常被抛出.
这有什么问题?

注意:当我使用SandBox(ENVIRONMENT_SANDBox)和开发证书文件发送推送通知时,它可以正常工作.但是,生产证书文件和ENVIRONMENT_PRODUCTION不起作用.

<?PHP
error_reporting(E_ALL);
ini_set('display_errors',1);

/**
 * @param string $device_token   unique device token
 * @param string $custom_message message that needs to be pushed
 * @param string $push_service   which service to use ( ApnsPHP/UrbanAirship )
 *
 * @return bool
 * @throws ApnsPHP_Exception
 * @throws ApnsPHP_Message_Exception
 * @throws ApnsPHP_Push_Exception
 * @throws Exception
 */
function send_apple_push_notification_test( $device_token,$custom_message,$push_service = 'ApnsPHP' ) {

    if ( empty( $device_token ) || empty( $custom_message ) ) {
        return false;
    }

    // Report all PHP errors
    error_reporting( -1 );

    // Adjust to your time-zone
    date_default_timezone_set( 'America/New_York' );

    // Using Autoload all classes are loaded on-demand
    require_once 'includes/ApnsPHP/Autoload.PHP';

    try {

        // Instantiate a new ApnsPHP_Push object
        $push = new ApnsPHP_Push(
            ApnsPHP_Abstract::ENVIRONMENT_PRODUCTION,'/home/xxxxx/public_html/wp-content/themes/yyyyyy/includes/ApnsPHP-pem/AppPushNotify.pem'
        );

        // Set the Root Certificate Authority to verify the Apple remote peer
        $push->setRootCertificationAuthority( '/home/xxxxx/public_html/wp-content/themes/yyyyyy/includes/ApnsPHP-pem/entrust_Root_Certification_Authority.pem' );

        // Connect to the Apple Push Notification Service
        $push->connect();

        // Instantiate a new Message with a single recipient
        $message = new ApnsPHP_Message_Custom( (string) $device_token );

        // Set a custom identifier. To get back this identifier use the getCustomIdentifier() method
        // over a ApnsPHP_Message object retrieved with the getErrors() message.
        $message->setCustomIdentifier( "xxxyyyzzz-" . time() );

        // Set a simple welcome text
        $message->setText( (string) $custom_message );

        // Play the default sound
        $message->setSound();

        // Set the expiry value to 30 seconds
        $message->setExpiry( 60 );

        // Set the "View" button title.
        $message->setActionLocKey( 'See the message.' );

        // Add the message to the message queue
        $push->add( $message );

        // Send all messages in the message queue
        $push->send();

        // disconnect from the Apple Push Notification Service
        $push->disconnect();

        // examine the error message container
        $aErrorQueue = $push->getErrors();
        print_r( $aErrorQueue );

        return true;

    } catch ( Exception $e ) {
        print_r( $e->getMessage() );
    }

    return false;
}

echo "start";
send_apple_push_notification_test( '20fcc5090eb1f539ac0fddd345r4d0c50e5bca071b742d3d9833f16dd97adeb','Test Msg for Production' );

解决方法

要使用生产环境,您的应用必须使用您的分发证书进行签名.测试此功能的唯一方法是提交到App Store并下载应用程序的App Store版本;或使用AdHoc构建.当您的应用程序使用开发证书签名时,您无法使用生产推送环境.

如果您已完成所有这些操作,请确保您没有使用与从开发环境获得的生产环境相同的设备令牌.他们将是不同的.

c# – 带模板的EPPlus无法正常工作

c# – 带模板的EPPlus无法正常工作

我目前正在使用 EPPlus项目来操作一些.xlsx文件.基本思想是我必须从给定的模板创建一个新文件.

但是当我从模板创建新文件时,表中的所有计算列都搞砸了.

我使用的代码如下:

static void Main(string[] args)
{
  const string templatePath = "template_worksheet.xlsx"; // the path of the template
  const string resultPath = "result.xlsx"; // the path of our result

  using (var pck = new ExcelPackage(new FileInfo(resultPath),new FileInfo(templatePath))) // creating a package with the given template,and our result as the new stream
  {
    // note that I am not doing any work ...
    pck.Save(); // savin our work
  }
}

例如,对于.xlsx文件(具有3列的表,最后一个只是其他列的总和),程序会创建一个.xlsx文件,其中最后一列具有相同的值(仅对第一列有效)所有行中的行).

以下图像显示了结果:

现在的问题是:
这里发生了什么 ?我的代码错了吗?
如果没有出现意外行为,我该如何完成这项任务?

解决方法

那绝对是在那里.我自己能够重现它.它与您创建的表有关.如果您打开文件并使用“表格工具”选项卡中的“转换为范围”选项将其删除,则问题就会消失.

我查看了源代码,它在zip级别提取了xml文件,并没有看到任何迹象表明它实际上正在弄乱它们 – 似乎是一个直接的副本.

很奇怪,因为如果我们创建并保存包含来自EPPlus的表的xlsx文件,问题就不存在了.这很好用:

[TestMethod]
public void Template_copy_test()
{
    //https://stackoverflow.com/questions/28722945/epplus-with-a-template-is-not-working-as-expected
    const string templatePath = "c:\\temp\\testtemplate.xlsx"; // the path of the template
    const string resultPath = "c:\\temp\\result.xlsx"; // the path of our result

    //Throw in some data
    var dtdata = new DataTable("tblData");
    dtdata.Columns.Add(new DataColumn("Col1",typeof(string)));
    dtdata.Columns.Add(new DataColumn("Col2",typeof(int)));
    dtdata.Columns.Add(new DataColumn("Col3",typeof(int)));

    for (var i = 0; i < 20; i++)
    {
        var row = dtdata.NewRow();
        row["Col1"] = "String Data " + i;
        row["Col2"] = i * 10;
        row["Col3"] = i * 100;
        dtdata.Rows.Add(row);
    }

    var templateFile = new FileInfo(templatePath);
    if (templateFile.Exists)
        templateFile.Delete();

    using (var pck = new ExcelPackage(templateFile))
    {
        var ws = pck.Workbook.Worksheets.Add("Data");
        ws.Cells["A1"].LoadFromDataTable(dtdata,true);

        for (var i = 2; i <= dtdata.Rows.Count + 1; i++)
            ws.Cells[i,4].Formula = String.Format("{0}*{1}",ExcelCellBase.GetAddress(i,2),3));

        ws.Tables.Add(ws.Cells[1,1,dtdata.Rows.Count + 1,4],"TestTable");

        pck.Save();
    }

    using (var pck = new ExcelPackage(new FileInfo(resultPath),templateFile)) // creating a package with the given template,and our result as the new stream
    {
        // note that I am not doing any work ...
        pck.Save(); // savin our work
    }
}

但…..

如果我们打开testtemplate.xlsx,删除表,保存/关闭文件,重新打开,并重新插入运行此问题时显示的完全相同的表:

[TestMethod]
public void Template_copy_Test2()
{
    //https://stackoverflow.com/questions/28722945/epplus-with-a-template-is-not-working-as-expected
    const string templatePath = "c:\\temp\\testtemplate.xlsx"; // the path of the template
    const string resultPath = "c:\\temp\\result.xlsx"; // the path of our result

    var templateFile = new FileInfo(templatePath);

    using (var pck = new ExcelPackage(new FileInfo(resultPath),and our result as the new stream
    {
        // note that I am not doing any work ...
        pck.Save(); // savin our work
    }
}

它必须是拉链复制方法中的东西,但我什么都没有跳出来.

但至少你可以看到解决它的问题.

厄尼

CORS无法正常工作的PHP

CORS无法正常工作的PHP

我正在尝试通过CORS将表单数据从www.siteone.com发布到www.sitetwo.com。我的ajax代码是这样的:

<script>
$(document).ready(function(){
        $("#submit").live('click',function() {
            var url = "http://www.sitetwo.com/cors.php";
            var data = $('#form').serialize();
            jQuery.ajax({
                url : url,type: "POST",data : $('#form').serialize(),}).done(function(response){
                    alert(response);
                    }).fail(function(error){
                    console.log(error.statusText);
                    });
                return false;


});
});
</script>

并且文件cors.php www.sitetwo.com如下:

<?php
 header('Access-Control-Allow-Origin: *');
 header('Access-Control-Allow-Methods: POST,GET,OPTIONS');
 echo "hai";
?>

但是仍然会引发Access-control-Allow-Origin错误。引发的错误是这样的:

XMLHttpRequest cannot load http://www.sitetwo.com/cors.php. Origin http://www.siteone.com is not allowed by Access-Control-Allow-Origin.

我知道,通过仅通过标头允许远程网站来使用CORS,就可以使用跨域请求。但是当我这样尝试时,会引发错误。我在这里错过了什么吗?这是我的请求/响应头:

Response Headers
Connection  Keep-Alive
Content-Length  487
Content-Type    text/html; charset=iso-8859-1
Date    Fri,23 Aug 2013 05:53:20 GMT
Keep-Alive  timeout=15,max=99
Server  Apache/2.2.15 (CentOS)
WWW-Authenticate    Basic realm="Site two Server - Restricted Area"
Request Headers
Accept  */*
Accept-Encoding gzip,deflate
Accept-Language en-US,en;q=0.5
Content-Length  43
Content-Type    application/x-www-form-urlencoded; charset=UTF-8
Host    www.sitetwo.com
Origin  http://www.siteone.com
Referer http://www.siteone.com/index.html
User-Agent  Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:23.0) Gecko/20100101 Firefox/23.0

关于java – MDM – APNS无法正常工作java.io.ioexception map failed的问题我们已经讲解完毕,感谢您的阅读,如果还想了解更多关于APK发行后,Android Google Maps无法正常工作、APNS PHP推送通知无法正常工作.得到超时、c# – 带模板的EPPlus无法正常工作、CORS无法正常工作的PHP等相关内容,可以在本站寻找。

本文标签: