2

空のアプリの解析ダウンロードと back4app を使用しています。クライアントとアプリケーション ID を設定しAppDelegateてアプリを実行しましたが、次のエラーが発生しました。

"2016-07-26 11:08:29.681 ParseStarterProject-Swift[1464:107722] [エラー]: 許可されていません (コード: 0、バージョン: 1.12.0) 2016-07-26 11:08:29.682 ParseStarterProject-Swift[1464 :107719] [エラー]: 最終的にエラーでコマンドを実行できませんでした: エラー Domain=Parse Code=0 "unauthorized" UserInfo={error=unauthorized, NSLocalizedDescription=unauthorized, temporary=0}"

ViewController が空です

AppDelegate:

import UIKit

import Parse

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {

var window: UIWindow?

//--------------------------------------
// MARK: - UIApplicationDelegate
//--------------------------------------

func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
    // Enable storing and querying data from Local Datastore.
    // Remove this line if you don't want to use Local Datastore features or want to use cachePolicy.
    Parse.enableLocalDatastore()
     Parse.setApplicationId("ciBn93EohqEq7WLJEAByrrVFfR6B3Fu98UJgRteY",clientKey: "KHKJgfJhSLAktjqmKHRhlaUtBhtzZELsdwexpIdf")

    PFUser.enableAutomaticUser()

    let defaultACL = PFACL();

    // If you would like all objects to be private by default, remove this line.
    defaultACL.publicReadAccess = true

    PFACL.setDefaultACL(defaultACL, withAccessForCurrentUser: true)

    if application.applicationState != UIApplicationState.Background {
        // Track an app open here if we launch with a push, unless
        // "content_available" was used to trigger a background push (introduced in iOS 7).
        // In that case, we skip tracking here to avoid double counting the app-open.

        let preBackgroundPush = !application.respondsToSelector("backgroundRefreshStatus")
        let oldPushHandlerOnly = !self.respondsToSelector("application:didReceiveRemoteNotification:fetchCompletionHandler:")
        var noPushPayload = false;
        if let options = launchOptions {
            noPushPayload = options[UIApplicationLaunchOptionsRemoteNotificationKey] != nil;
        }
        if (preBackgroundPush || oldPushHandlerOnly || noPushPayload) {
            PFAnalytics.trackAppOpenedWithLaunchOptions(launchOptions)
        }
    }

    return true
}

//--------------------------------------
// MARK: Push Notifications
//--------------------------------------

func application(application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: NSData) {
    let installation = PFInstallation.currentInstallation()
    installation.setDeviceTokenFromData(deviceToken)
    installation.saveInBackground()

    PFPush.subscribeToChannelInBackground("") { (succeeded: Bool, error: NSError?) in
        if succeeded {
            print("ParseStarterProject successfully subscribed to push notifications on the broadcast channel.\n");
        } else {
            print("ParseStarterProject failed to subscribe to push notifications on the broadcast channel with error = %@.\n", error)
        }
    }
}

func application(application: UIApplication, didFailToRegisterForRemoteNotificationsWithError error: NSError) {
    if error.code == 3010 {
        print("Push notifications are not supported in the iOS Simulator.\n")
    } else {
        print("application:didFailToRegisterForRemoteNotificationsWithError: %@\n", error)
    }
}

func application(application: UIApplication, didReceiveRemoteNotification userInfo: [NSObject : AnyObject]) {
    PFPush.handlePush(userInfo)
    if application.applicationState == UIApplicationState.Inactive {
        PFAnalytics.trackAppOpenedWithRemoteNotificationPayload(userInfo)
    }
}
}

ありがとう

4

2 に答える 2

1

私はあなたが何をすべきかを見つけます、それはただの変化です

これ

 Parse.setApplicationId("APP_ID",clientKey: "CLIENT_KEY")

これとともに

let configuration = ParseClientConfiguration{
        $0.applicationId = "APP_ID"
        $0.clientKey = "CLIENT_KEY"
        $0.server = "https://parseapi.back4app.com/"
    }

サーバーアドレスはそのまま

于 2016-07-27T04:45:32.420 に答える
0

appid とクライアント キーに何か問題があるに違いないと思います。

于 2016-07-26T14:32:58.487 に答える