我是IOS开发的新手。我有包含以下内容的课程。细节:
@interface GeoFenceReferenceDetails : NSObject {
NSString* directionType;
NSString* fenceCode;
NSNumber* fenceId;
NSString* fenceName;
NSString* geoFenceType;
}
另一个用于创建字典的“实用程序”类:
-(NSDictionary *) createGeoReferenceDict2: (GeoFenceReferenceDetails *) geoFenceDetails {
return [NSDictionary dictionaryWithObjectsAndKeys:
geoFenceDetails.directionType, @"directionType",
geoFenceDetails.fenceCode, @"fenceCode",
geoFenceDetails.fenceId, @"fenceId",
geoFenceDetails.fenceName, @"fenceName",
geoFenceDetails.geoFenceType, @"geoFenceType",
nil];
}
现在我想在第三个类中创建一个 GeoFenceReferenceDetails 对象,它以下列方式提供输出:
{
directionType = None;
fenceCode = 12;
fenceId = 81;
fenceName = "ABC";
geoFenceType = Circle;
}
这就是我正在做的事情。我在第三类中创建 GeoFenceReferenceDetails 的“fenceDetails”对象,然后执行以下操作:
fenceDetails = [[GeoFenceReferenceDetails alloc] init];
fenceDetails.fenceId=[NSNumber numberWithInt:121];
NSLog(@"%i",[fenceDetails.fenceId intValue]);
NSDictionary* geoFenceReference = [[Utility sharedInstance] createGeoReferenceDict2:fenceDetails];
NSLog(@"%@ ",[geoFenceReference description]);
但我得到的只是
{
}
你能帮助我吗 ?