NSDictionary の値の抽出と変更に問題があります。
NSDictionary *dict = [[NSUserDefaults standardUserDefaults] objectForKey:@"dictRecensiti"];
NSLog(@"dict %@",dict);
これは出力です:
dict (
(
{
ingredientiRecensito = "AQUA,CETYL%20PALMITATE,PROPYLENE%20GLYCOL,SORBITOL,PRUNUS%20DULCIS,ISODODECANE,STEARIC%20ACID,CETYL%20ALCOHOL,LANOLIN,CYCLOPENTASILOXANE,CALENDULA%20OFFICINALIS,SQUALANE,HEXYLENE%20GLYCOL,FRUCTOSE,GLUCOSE,SUCROSE,UREA,DEXTRIN,ALANINE,GLUTAMIC%20ACID,ASPARTIC%20ACID,HEXYL%20NICOTINATE,TRIETHANOLAMINE,OCTYL%20METHOXYCINNAMATE,OCTYL%20COCOATE,BISABOLOL,CARBOMER,PHENOXYETHANOL,METHYLPARABEN,BUTYLPARABEN,ETHYLPARABEN,PROPYLPARABEN,SEBACIC%20ACID,CI%2047000,CI%2061565,GLYCERYL%20LINOLEATE,GLYCERYL%20LINOLENATE,BUTYLENE%20GLYCOL,ENTEROMORPHA%20COMPRESSA%20EXTRACT,ALLANTOIN,SODIUM%20METHYLPARABEN,SODIUM%20BUTYLPARABEN,SODIUM%20ETHYLPARABEN,SODIUM%20PROPYLPARABEN,HYALURONIC%20ACID,BHT,PARFUM";
nomeRecensito = "Levissime%20Crema%20idratante%20pelli%20sensibili";
testoRecensito = "Massimomosmaomomaodmosmodmasoosaocaoaomcoasocmosamomaodm.%20Dmosadmoasmdomasd.%20Sdoamdoamodsmao";
tipoRecensito = "Crema%20viso%20pelli%20Sensibili";
}
),
{
ingredientiRecensito = "WATER,GLYCERIN,PEG-7%20GLYCERYL%20COCOATE,DISODIUM%20LAURETH%20SULFOSUCCINATE,SODIUM%20COCOAMPHOACETATE,PEG-25%20HYDROGENATED%20CASTOR%20OIL,CETEARETH-60%20MYRISTYL%20GLYCOL,PEG-200%20HYDROGENATED%20GLYCERYL%20PALMATE,LAURETH-3,COCO-GLUCOSIDE,AQUAPHILUS%20DOLOMIAE%20EXTRACT,ARGININE,CAPRYLYL%20GLYCOL,CITRIC%20ACID,EVENING%20PRIMROSE%20OIL/PALM%20OIL%20AMINOPROPANEDIOL%20ESTERS,GLYCINE,OENOTHERA%20BIENNIS%20OIL,SORBIC%20ACID,TOCOPHEROL";
nomeRecensito = "Avene%20XeraCalm%20A.D.%20olio%20detergente%20liporestitutivo";
testoRecensito = Blblblbnnn;
tipoRecensito = "Olio%20detergente";
}
)
今私は %20 を置き換えたいので、私は書きました:
NSString *stringV = [dict valueForKey:@"ingredientiRecensito"];
stringV = [stringV stringByReplacingOccurrencesOfString:@"%20" withString:@" "];
NSLog(@"%@",stringV);
アプリがクラッシュし、これが出力されます。
[__NSArrayI stringByReplacingOccurrencesOfString:withString:]: unrecognized selector sent to instance 0xc90f360
前もって感謝します
編集:これは、この nsuserdefault を使用するための最良の解決策ではないことを理解しています。そのため、この nsuserdefault から別のタイプの出力を持つようにコードを根本的に変更しようとしています。どうもありがとう