小编pre*_*ite的帖子

APNS推送通知不适用于生产

我创建了一个应用程序来从Web服务器发送远程通知.当我在开发模式下测试应用程序时,所有通知都在手机上正确到达,在AppStore发布后,应用程序不再收到通知.

这就是我做的:

  1. 创建了生产私钥和开发私钥.
  2. 通过传递以前生成的CertFile,在我的App ID上生成两个SSL证书.我100%确定已正确生成2个密钥并正确传递它们以从App中的Dev Center下载SSL证书.
  3. 创建了一个用于开发的文件.pem和一个用于生成的文件(通过转换从我的KeyChain等提取的文件.p12).
  4. 创建了2个不同的配置文件,一个用于开发,另一个用于连接到步骤1的AppID的生产.
  5. 使用在步骤4中创建的正确Provisioning Profiles在Build Settings中签名应用程序.
  6. 创建了一个Web应用程序来捕获和存储用户令牌.
  7. 创建了一个php页面来测试Push Notification Sending.

这是我测试的:

  1. 使用沙盒链接上的telnet测试了开发生成的.pem文件,并获得了成功的答案.
  2. 使用telnet在生产链接上测试生产生成的.pem文件,并获得成功的答案.
  3. 我百分百肯定已经在我的网络应用程序中存储了我的iPhone的开发令牌.
  4. 我百分百肯定已经在我的网络应用服务器上存储了我的iPhone的制作令牌.
  5. 我100%肯定会将我的php页面传递给Apple Server正确的消息(用于开发和生产).
  6. php页面总是返回Apple Server的成功消息(用于开发和生产).

以下是我在Xcode上签署应用的方式:

在此输入图像描述 在此输入图像描述 在此输入图像描述 在此输入图像描述

这是发送通知的php页面的代码:

    $ctx = stream_context_create();

    //stream_context_set_option($ctx, 'ssl', 'passphrase', 'development_pwd');
    //stream_context_set_option($ctx, 'ssl', 'local_cert', 'ck_development.pem');
    //$fp = stream_socket_client('ssl://gateway.sandbox.push.apple.com:2195', $err, $errstr, 60, STREAM_CLIENT_CONNECT|STREAM_CLIENT_PERSISTENT, $ctx); //test

    stream_context_set_option($ctx, 'ssl', 'passphrase', 'production_pwd');
    stream_context_set_option($ctx, 'ssl', 'local_cert', 'ck_production.pem');
    $fp = stream_socket_client('ssl://gateway.push.apple.com:2195', $err, $errstr, 60, STREAM_CLIENT_CONNECT|STREAM_CLIENT_PERSISTENT, $ctx); //production

    echo "<p>Connection Open</p>";
    if(!$fp){
        echo "<p>Failed to connect!<br />Error Number: " . $err . " <br />Code: …
Run Code Online (Sandbox Code Playgroud)

xcode push apple-push-notifications ios

22
推荐指数
2
解决办法
2万
查看次数

Xcode 5.1 ld:找不到-lGoogleAnalyticsServices的库

今天我将Xcode更新为Xcode 5.1,现在每次我尝试编译代码并在模拟器上测试时,我都会遇到有关架构86_64和Google Analytics Services Library的错误.这就是我得到的:

Ld /Users/prelite/Library/Developer/Xcode/DerivedData/iSanMarino-hkgasucjnyttlxcbtgqjjpcxutzx/Build/Products/Debug-iphonesimulator/iSanMarino.app/iSanMarino normal x86_64
    cd "/Users/prelite/Desktop/iSanMarino 3.0"
    export IPHONEOS_DEPLOYMENT_TARGET=7.0
    export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch x86_64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator7.1.sdk -L/Users/prelite/Library/Developer/Xcode/DerivedData/iSanMarino-hkgasucjnyttlxcbtgqjjpcxutzx/Build/Products/Debug-iphonesimulator -L/Users/prelite/Desktop/iSanMarino\ 3.0/iSanMarino/Analytics -F/Users/prelite/Library/Developer/Xcode/DerivedData/iSanMarino-hkgasucjnyttlxcbtgqjjpcxutzx/Build/Products/Debug-iphonesimulator -filelist /Users/prelite/Library/Developer/Xcode/DerivedData/iSanMarino-hkgasucjnyttlxcbtgqjjpcxutzx/Build/Intermediates/iSanMarino.build/Debug-iphonesimulator/iSanMarino.build/Objects-normal/x86_64/iSanMarino.LinkFileList -Xlinker -objc_abi_version -Xlinker 2 -fobjc-arc -fobjc-link-runtime -Xlinker -no_implicit_dylibs -mios-simulator-version-min=7.0 -lGoogleAnalyticsServices -framework AudioToolbox -framework CoreData -framework QuartzCore -framework SystemConfiguration -lsqlite3 -framework EventKitUI -framework EventKit -framework CoreLocation -framework MessageUI -framework MapKit -framework UIKit -framework Foundation -framework CoreGraphics -Xlinker -dependency_info -Xlinker /Users/prelite/Library/Developer/Xcode/DerivedData/iSanMarino-hkgasucjnyttlxcbtgqjjpcxutzx/Build/Intermediates/iSanMarino.build/Debug-iphonesimulator/iSanMarino.build/Objects-normal/x86_64/iSanMarino_dependency_info.dat -o /Users/prelite/Library/Developer/Xcode/DerivedData/iSanMarino-hkgasucjnyttlxcbtgqjjpcxutzx/Build/Products/Debug-iphonesimulator/iSanMarino.app/iSanMarino

Undefined symbols for architecture x86_64:
  "_deflate", referenced from:
      +[GAICompressionUtil gai_dataByCompressingBytes:length:compressionLevel:mode:] in libGoogleAnalyticsServices.a(GAICompressionUtil.o) …
Run Code Online (Sandbox Code Playgroud)

xcode google-analytics compiler-errors ios7.1 xcode5.1

9
推荐指数
1
解决办法
1万
查看次数