プッシュ

2011 ワード

iOSプロジェクトの自動化パッケージ
上のリンクでshellスクリプトを作成するときにコードがあります
python3 myjpush.py  "${bundleShortVersion}(${bundleVersion})    " "${project_name}"

このコードの役割は、プロジェクトが正常にアップロードされたときに、携帯電話側に通知を送ることです.
プッシュサービス
私がここで使っているオーロラプッシュのPython SDK
詳細なインストールおよび説明は、ドキュメントを参照してください.
携帯電話にプッシュするpythonコードを簡単に書きました
app_keyとmaster_secretはオーロラプッシュでappプロジェクトを作成して取得する必要があります
# -*- coding:utf-8 -*-
import jpush as jpush
import push_error as error
import sys

app_key = u'e946ee055b7cd6c1ab119f03'
master_secret = u'7e0a4fb007ec3317f63c321d'


def sendPush(version, appname):
    _jpush = jpush.JPush(app_key, master_secret)  ##1、   JPush,  AppKey,Master Secret;   JPush,
    push = _jpush.create_push()

    # if you set the logging level to "DEBUG",it will show the debug logging.
    # _jpush.set_logging("DEBUG")
    # --------------------------------      ---------------------------
    #       ,  JSON     ,             。
    # push.audience=jpush.all_ ;#audience              ;        ,JPush        ,  :  、  、  ID、  、   。
    push.audience = jpush.all_

    message = appname + '  :' + version + '      ,       '
    print(message)
    push.notification = jpush.notification(alert=message)


    push.platform = jpush.all_  # platform             

    try:
        response = push.send()
        print('send')
    except error.Unauthorized:
        print('send1')
        raise error.Unauthorized("Unauthorized")
    except error.APIConnectionException:
        print('send2')
        raise error.APIConnectionException("conn error")
    except error.JPushFailure:
        print("JPushFailure")
    except:
        print("Exception")


sendPush(sys.argv[1], sys.argv[2])
print('done')


myjpush.py
プッシュの携帯電話端末-iOS
オーロラプッシュが参考になります
iOS SDK統合ガイド
iOS証明書設定ガイド
私の簡単なdemoを添付して、コードはswiftが書いたのです
トランスファゲート