Friend, I was with a problem similar to yours, was trying to store data generated in one class and move to another. The solution I found was the following:
Go to the class that will receive the data, and create a variable that will save the data and its property. Then create a method that takes as an argument the data you want to save, and inside the method, it will be stored in the variable you created.
In the FileNameData.m file, place the #import "ClassNameStore.h" and instantiate an object of the class that will receive the data, and pass the value you want in the method argument.
As in the example code I'll do below to get better illustrated.
*** ClasseQueRecebeDados.h ***
import<UIKit/UIKit.h>
@interface ClasseQueRecebeDados : NSObject{
NSString* receptor;
}
@property(nonatomic, retain) NSString* receptor;
-(void)metodoTransfereDados:(NSString*)dadosRecebido;
@end
In the file ClassRouteData.m you implement this method as follows:
#import "ClasseQueRecebeDados.h"
@implementation ClasseQueRecebeDados
@syntesize receptor;
-(void)metodoTransfereDados:(NSString*)dadosRecebido{
self.receptor = dadosRecebido;
}
@end
Now in ClassWhatMakeData.m you do so:
// Importe a classe para instanciar um objeto dela e ter acesso ao seu método.
#import "ClasseQueRecebeDados.h"
@implementation ClasseQueForneceDados
-(void)DentroDeAlgumMetodoDaClasseQueForneceDados{
ClasseQueRecebeDados* armazenador = [[ClasseQueRecebeDados alloc]init];
// Aqui você instancia a classe ClasseQueRecebeDados e usa o método.
[armazenador metodoTransfereDados: self.dadoQueSeráEnviadoHaOutraClasse];
}
(DEMAIS CODIGO DA IMPLEMENTAÇÂO ...)
@end
When you use the method, you will send the data to the variables of the object you instantiated. Within the method, I believe it will be more useful to save the data in a plist, than to have it only in the app's memory, so the data will be visible from various points in the app.
I hope you have helped, any questions just comment below!