iOS, Android, cocos2d-x 개발

Unmarshalling unknown type 에러

msbahng 2015. 6. 8. 13:33
반응형

Activity 간에 Parcelable Object Array를 포함한 Parcelable Object를 넘기려고 하는데 데이터가 제대로 전달되지 않음.

Parcelabel Object 에서는 writeTypedList 와 readTypedList 를 사용하여  Parcelable Object Array를 read/write 함

dest.writeTypedList(joined_users); joined_users = new ArrayList<Test>(); in.readTypedList(joined_users, User.CREATOR); 여러가지 검토를 해보다가 Unmarshalling unknown type 에러가 발생.

문제는 아래의 코드였음. Parcelable Obejct 에서 변수를 정의하고 아래와같이 null 체크를 하면 parcel에 쓰지 않는 경우가 발생하고 위의 에러가 발생함.

다른 형태의 에러로 나타날 경우가 있어 원인을 찾기 힘들었음.


@Override
	public void writeToParcel(Parcel dest, int flags) {

		if (_id!=null) dest.writeString(_id);

	        if (email!=null) dest.writeString(email);
		if (screenname!=null) dest.writeString(screenname);
		if (profile_thumb_url!=null) dest.writeString(profile_thumb_url);
		if (profile_pic_url!=null) dest.writeString(profile_pic_url);
		if (created_at!=null) dest.writeLong(created_at.getTime());
}



728x90
반응형