小编use*_*878的帖子

无法解密类Employee的对象(NS.object.0); 该类可以在源代码中定义,也可以在未链接的库中定义

我试图通过序列化数组将一系列'Employee'对象iPhone传递给Apple Watch:

NSData *encodedObject = [NSKeyedArchiver archivedDataWithRootObject:employees];
Run Code Online (Sandbox Code Playgroud)

并在Watch侧进行反序列化:

NSMutableArray *employees = [NSKeyedUnarchiver unarchiveObjectWithData:encodedObject];
Run Code Online (Sandbox Code Playgroud)

这是'员工'类:

@interface Employee : NSManagedObject
@property (nonatomic, retain) NSNumber * employeeID;
@property (nonatomic, retain) NSString * name;
@property (nonatomic, retain) NSNumber * age;
@property (nonatomic, retain) NSString * address;
@property (nonatomic, retain) NSString * designation;
@property (nonatomic, retain) NSString * teamName;
@property (nonatomic, retain) NSString * gender;
@property (nonatomic, retain) NSNumber * dateOfJoining;
@end
Run Code Online (Sandbox Code Playgroud)

我是否必须在Watch端进行任何更改才能修复此错误?

objective-c nskeyedarchiver ios nskeyedunarchiver watchkit

12
推荐指数
2
解决办法
5124
查看次数

在 Android Lollipop 上关闭蓝牙时应用程序崩溃

我有一个 BroadcastReceiver,它检测蓝牙状态的变化并相应地执行操作 - 当蓝牙打开时,它会打开信标的监控服务。当蓝牙关闭时,它会停止监控服务。这发生在 Nexus 5 上。接收器如下

public class BluetoothReceiver extends BroadcastReceiver {

public void onReceive(Context context, Intent intent) {

    String action = intent.getAction();

    if (BluetoothAdapter.ACTION_STATE_CHANGED.equals(action)) {

        // If Bluetooth is switched on
        if (intent.getIntExtra(BluetoothAdapter.EXTRA_STATE, -1)
                == BluetoothAdapter.STATE_ON) {

            //Start the beacon detection service
            if (EmployeeSignupManager.getEmployeeUUIDFromSharedPreference(context) != null) {

                // Register Receiver
                new AttendanceManager().startBroadCastReceiverForBeaconDetection(context);

                // Start Service
                SO.startBeaconServices(true);
            }

        }


        // If Bluetooth is switched off

        else if (intent.getIntExtra(BluetoothAdapter.EXTRA_STATE, -1)
                == BluetoothAdapter.STATE_OFF) {

            //Stop the beacon detection service
            if (EmployeeSignupManager.getEmployeeUUIDFromSharedPreference(context) …
Run Code Online (Sandbox Code Playgroud)

android bluetooth altbeacon

4
推荐指数
2
解决办法
3664
查看次数