Vorrei includere le risorse immagine in una libreria cocoapod, ma ho problemi ad accedervi. Ho letto queste risorse per un aiuto:Accesso alle risorse nel pod
Tuttavia, nessuno mi punto nella direzione di accesso alle risorse. Ho provato il seguente:
[UIImage imageWithData:[NSData dataWithContentsOfURL:[(NSBundle *)[NSBundle bundleWithIdentifier:@"Assets"] URLForResource:@"[email protected]" withExtension:@"png"]]]
[UIImage imageWithData:[NSData dataWithContentsOfURL:[(NSBundle *)[NSBundle bundleWithIdentifier:@"Assets"] URLForResource:@"my-image" withExtension:@"png"]]]
[UIImage imageWithData:[NSData dataWithContentsOfURL:[(NSBundle *)[NSBundle bundleWithIdentifier:@"Assets.bundle"] URLForResource:@"my-image" withExtension:@"png"]]]
[UIImage imageWithData:[NSData dataWithContentsOfURL:[(NSBundle *)[NSBundle mainBundle] URLForResource:@"my-image" withExtension:@"png"]]]
[[UIImage imageWithData:[NSData dataWithContentsOfURL:[(NSBundle *)[NSBundle mainBundle] URLForResource:@"[email protected]" withExtension:@"png"]]]
[UIImage imageNamed:@"my-asset"]
[UIImage imageNamed:@"[email protected]"]
Ma nessuno di loro funziona.
Ho installato il mio podspec con queste alternative e né lavoro con quanto sopra:
s.resources = ['Pod/Assets/*.{png, jpg}', 'Pod/Assets/**/*.{png, jpg}']
s.resource_bundles = {
'Assets' => ['Pod/Assets/*.{png, jpg}', 'Pod/Assets/**/*.{png, jpg}']
}
Le risorse appaiono in 'Sviluppo Pods/My App/Resources' dopo un pod update
, ma non posso accedere per la vita di me. Non ci sono pacchetti e non c'è nulla chiamato "Risorse".
Qualsiasi aiuto o guida sarebbe apprezzato.
fai sia '' s.resources' e s.resource_bundles' o provato separatamente? Forse c'è qualche scontro. –
@NiklasBerglund Entrambi separatamente. – RileyE