标签: parse-platform

Parse/Swift致命错误:使用未实现的初始化程序'init()

如果有人有任何使用Swift使用Parse的经验,特别是子类化PFObject .....我无法弄清楚为什么下面的saveinbackground调用会抛出上述错误?

谢谢!

func saveNewPerson(name: String) {

        var myPeeps = [Person]()

        if let currentUser = PFUser.currentUser() {

            if currentUser.valueForKey("myPeeps")?.count < 1 {
                myPeeps = []
            } else {
                myPeeps = currentUser.valueForKey("myPeeps") as! [Person]
            }

            let newPerson = Person(name: name, stores: [:])

        myPeeps.append(newPerson)

        currentUser.setObject(myPeeps, forKey: "myPeeps")

        println(currentUser.valueForKey("myPeeps")?.count)


                //WHY DOES THIS SAVE THROW ERROR FOR NOT INITIALZING?
        currentUser.saveInBackgroundWithBlock{ succeeded, error in
            if succeeded {
                //3
                println("Saved")
            } else {
                //4
                if let errorMessage = error?.userInfo?["error"] as? String {
                    self.showErrorView(error!)
                    }
                }
            } …
Run Code Online (Sandbox Code Playgroud)

ios parse-platform swift

0
推荐指数
1
解决办法
451
查看次数

Swift Closures问题

我在从闭包中检索数据时遇到问题.我正在调用函数getWallImages,它应该返回一个数组.我可以从闭包内打印数组的内容,但在它之外,数组是空的.

import Foundation
import Parse

class WallPostQuery {

    var result = [WallPost]()

    func getWallImages() -> [WallPost] { 
        let query = WallPost.query()!

        query.findObjectsInBackgroundWithBlock { objects, error in    
            if error == nil {     
                if let objects = objects as? [WallPost] {
                    self.result = objects
                    //This line will print the three PFObjects I have
                    println(self.result)
                }
            }
        }

        //this line prints [] ...empty array?
        println(result)
        return self.result
    }
}
Run Code Online (Sandbox Code Playgroud)

如何从闭包中获取值?

closures parse-platform swift

0
推荐指数
1
解决办法
130
查看次数

调用PFUser.logOut()解析swift2后,当前用户不是nil

我想用解析器构建一个简单的LogOut Button,但是当前用户没有得到nil.

PFUser.logOut()
var currentUser = PFUser.currentUser() // this should be nil but it isn't :(
print(currentUser)
Run Code Online (Sandbox Code Playgroud)

我也尝试过:

PFUser.logOutInBackground()
var currentUser = PFUser.currentUser() // this is also not nil :(
Run Code Online (Sandbox Code Playgroud)

因此,当我打印currentUser时,它不应该是它应该是的.它是:

Optional(<PFUser: 0x7f8d99dd2320 , objectId: new, localId: local_58d62becf7a6f1dc> {
Run Code Online (Sandbox Code Playgroud)

})

所以我认为该应用正在创建一个新用户?!

ios parse-platform swift pfuser swift2

0
推荐指数
1
解决办法
889
查看次数

将Parse推送通知集成到Xcode 7项目(Swift)

我正在将Parse Push通知集成到一个应用程序中,并且已经陷入了Swift 2.0转换.代码是:

if application.respondsToSelector("registerUserNotificationSettings:") {
            let userNotificationTypes: UIUserNotificationType = [.Alert, .Badge, .Sound]
            let settings = UIUserNotificationSettings(forTypes: userNotificationTypes, categories: nil)
            application.registerUserNotificationSettings(settings)
            application.registerForRemoteNotifications()
        } else {
            let types: UIUserNotificationType = [.Badge, .Alert, .Sound]
            application.registerForRemoteNotificationTypes(types)
        }
Run Code Online (Sandbox Code Playgroud)

Xcode抱怨"无法将类型'UIUserNotificationType'的值转换为预期的参数类型'UIRemoteNotificationType'

apple-push-notifications ios parse-platform swift2

0
推荐指数
1
解决办法
1241
查看次数

可可错误3840仅解析代码iOS7

背景:几天前我决定从Facebook-iOS-SDK v3.24将Facebook SDK更新为FBSDKCoreKit.我相应地更新了我的Podfile并安装了所有库.然后我开始更新一些代码以使用更新的SDK规范.

经过一段时间的努力后,我改变主意,决定回滚到旧版本.我做了所有必要的cocoapods更改和安装,丢弃了Xcode中的所有本地更改,重新编译并运行.一切都很好......或者我认为.

问题:现在,当我尝试在我的旧iOS7测试设备上运行时,每当应用程序启动时我都会收到错误消息.以下是确切的控制台输出:

2015-10-15 20:14:31.271 hiatus[184:6003] [Error]: Failed to run command eventually with 
error: Error Domain=NSCocoaErrorDomain Code=3840 "The operation couldn’t be
completed. (Cocoa error 3840.)" (JSON text did not start with array or object
and option to allow fragments not set.) UserInfo=0x14d67d20 {NSDebugDescription=
JSON text did not start with array or object and option to allow fragments not set.}
Run Code Online (Sandbox Code Playgroud)

在控制台中显示此错误后,没有Parse功能可用.在我的情况下,这意味着用户无法登录.而是显示空错误.

在iOS8和iOS9(模拟器和真实设备)上一切正常.我正在使用Parse v1.9.我试过清理项目,重置等,但没有任何成功.

我已经能够将其跟踪到PFEventuallyQueue.m中的特定功能.它似乎发生在(void)_runCommandsWithRetriesCount:.我只是无法知道如何解决它.

cocoa objective-c facebook-ios-sdk cocoapods parse-platform

0
推荐指数
1
解决办法
737
查看次数

在swift 2.0中将NSArray转换为NSMutable Array

当我尝试将nsarray对象插入到可变的swift数组时,我得到了这个控制台输出.代码工作正常,但最后,它抛出一个错误.请帮我解决这个错误.

Successfully retrieved 3 scores.
Optional("HmEbbowtxW")
<Events: 0x7b08bdf0, objectId: HmEbbowtxW, localId: (null)> {
    CreatedBy = "<PFUser: 0x7b02ed10, objectId: 04jp1ZeBn6>";
    EventDescription = test;
    EventName = test;
}
Optional("97BzKUxFdE")
<Events: 0x7b08cae0, objectId: 97BzKUxFdE, localId: (null)> {
    CreatedBy = "<PFUser: 0x7b02ed10, objectId: 04jp1ZeBn6>";
    EventDescription = fg;
    EventName = gfg;
}
Optional("QDHkg5tiUw")
<Events: 0x7b08cf80, objectId: QDHkg5tiUw, localId: (null)> {
    CreatedBy = "<PFUser: 0x7b02ed10, objectId: 04jp1ZeBn6>";
    EventDescription = asdasdasd;
    EventName = sdsd;
}
Could not cast value of type '__NSArrayI' (0x228e164) to 'NSMutableArray' (0x228e1c8).
Run Code Online (Sandbox Code Playgroud)

这是我的代码 …

nsmutablearray parse-platform swift

0
推荐指数
1
解决办法
863
查看次数

如何使用swift在Parse中获取所有创建的类名?

任何人都可以告诉我一个Query在Parse Core中创建的类列表的方法.我正在使用Swift 2.0和XCode 7.

基本上,我有4个不同的类(例如:Class1,Class2,ClassName3,ClassName4)保存不同的数据.我想只获取类名称并使用我的应用程序显示它PFQueryTableViewController.

override func queryForTable() -> PFQuery {
        var query : PFQuery = PFQuery(className: "ClassName1")
        query.orderByAscending("songName")
        return query
    }
Run Code Online (Sandbox Code Playgroud)

上面的代码查询ClassName1中的数据,但是,我想显示类名而不是特定类中的数据.

谢谢

非常感谢

ios parse-platform swift

0
推荐指数
1
解决办法
445
查看次数

Android中的CCAvenue集成

很高兴见到你.

我正在使用parse.com作为后端开发购物应用程序.我将与印度支付网关(CCAVenue)集成.我正在将CCAvenue集成到我的Android应用程序中,我正在进行非无缝集成.我的商家服务器是php,我正在将httppost保存到我的商家服务器中保存的GetRSA.php文件中.我使用的代码如下

 List<NameValuePair> httpParams = new ArrayList<NameValuePair>();
 httpParams.add(new BasicNameValuePair("access_code", intent.getStringExtra("access_code")));
 httpParams.add(new BasicNameValuePair("order_id", intent.getStringExtra("order_id")));

 String vResponse = sh.makeServiceCall(intent.getStringExtra(RSA_KEY_URL), ServiceHandler.POST, httpParams);
Run Code Online (Sandbox Code Playgroud)

访问代码,订单ID和RSA URL是从上一个活动传递的,我使用的ACESS_CODE是CCAvenue提供的,而RSA_KEY_URL是我在商家服务器中保留GetRSA.php的路径.

但我得到的回答是"!错误!来电未登记/商家未找到."

有什么不对?

我会等你的回复.

谢谢.

android payment-gateway ccavenue parse-platform

0
推荐指数
1
解决办法
5736
查看次数

Android setText无法在TextView上运行

我试图将Textview的值更改为我正在查询解析的某些信息,但由于某种原因,.setText它没有生效.

我尝试谷歌搜索,但.getString也无法正常工作.我是Parse任何建议的新手?

我的代码如下:

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.parse.FindCallback;
import com.parse.GetCallback;
import com.parse.ParseException;
import com.parse.ParseObject;
import com.parse.ParseQuery;

import org.w3c.dom.Text;

import java.util.List;


/**
* A simple {@link Fragment} subclass.
 */
public class productDetail extends Fragment {


public productDetail() {
    // Required empty public constructor
}






@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {

    final View theView = inflater.inflate(R.layout.fragment_product_detail, container, false);

    final TextView productNameLabel = (TextView) …
Run Code Online (Sandbox Code Playgroud)

java android parse-platform

0
推荐指数
1
解决办法
714
查看次数

变量在if-else子句之后变为nil

从IF子句中的parse执行查询并存储在StaffID中.我得到了我想要的东西.

但是在if/else子句之后,StaffID变量变为Nil

这是代码

func StaffIdQuery(DeviceToken: String) -> String
{
    var StaffID = ""
    let StaffIdQuery = PFQuery(className: "Staff")
    StaffIdQuery.whereKey("StaffDeviceToken", equalTo: DeviceToken)
    StaffIdQuery.getFirstObjectInBackgroundWithBlock {
        (objects:PFObject?, error: NSError?) -> Void in

        if error == nil && objects != nil {
            StaffID = objects?.valueForKey("StaffID") as! String
            print(StaffID) //This seems fine
        }
        else {
    // Log details of the failure
            print("Error: \(error!) \(error!.userInfo)")
        }
    }
    print(StaffID) //this becomes nil
    return StaffID
}
Run Code Online (Sandbox Code Playgroud)

我应该修复什么来获取查询数据?

if-statement ios parse-platform swift

0
推荐指数
1
解决办法
257
查看次数