そうです、このc++コードを置き換えました
/ / Get the attribute
for (oscar :: ODStruct :: iterator iter = data.begin (); ites! = data.end (); iter + +)
{
mem = iter-> second;
if (mem.get (s_vals))
for (auto i = s_vals.begin (); in! = s_vals.end (); i + +)
[_owner SetValue: [NSString string with format: @ "% s", i-> c_str ()]
forKey: [NSString string with format: @ "% s", iter-> first.c_str ()]];
else if (mem.get (i_vals))
for (auto i = i_vals.begin (); in! = i_vals.end (); i + +)
[_owner SetValue: [NSString string with format: @ "% d", * i]
forKey: [NSString string with format: @ "_% s", iter-> first.c_str ()]];
else if (mem.get (f_vals))
for (auto i = f_vals.begin (); in! = f_vals.end (); i + +)
[_owner SetValue: [NSString string with format: @ "% f", * i]
forKey: [NSString string with format: @ "_% s", iter-> first.c_str ()]];
else if (mem.get (d_vals))
for (auto i = d_vals.begin (); in! = d_vals.end (); i + +)
[_owner SetValue: [NSString string with format: @ "% lf", * i]
forKey: [NSString string with format: @ "_% s", iter-> first.c_str ()]];
else
std :: cout << "Do not find for" << iter-> first.c_str () << std :: endl;
}
次のobj-cコードで
_owner.name = @ "test"
_owner.type = @ "test1"
_owner.unit = @ "test2"
それはうまくいきます!クラスに別の C++ コードを残したので、おそらく "setValue: forKey: ' で何かを見逃している可能性があります。