0

lets say I have the following class

@implementation userSetUp{
    NSString *folderIdentification;
}

-(id) initWithDriveService:(GTLRDriveService *)driveService withFilePath: (NSString *)aFilePath{
 folderIdentification = some string
 }
end

now I have another method in the same class, but folderIdentification is returning null even though I defined it in the initializer method for the class. Could someone please tell me how I should define folderIdentification so that I can get the same instance behavior found in swift and java and the folderIdentification in reuploadToFolder does not return null?

-(void )reuploadToFolder{
 folderIdentification is used but for some reason is nill.
 }
JustANoob
  • 65
  • 2
  • 14
  • Make sure to call super's designated initializer in the beginning of your `initWithDriveService:withFilePath:` method, and assign the result to `self`, and make sure to do this *before* you assign the instance variable (Objective-C is different from Swift in this regard). Also, make sure to return `self` at the end of the method. I can't guarantee that that's the source of your problem, but might be, since the initializer as written is incorrect. – Charles Srstka Sep 20 '17 at 03:14
  • 1
    Please post real code. The code you have posted isn't valid Objective-C code and your `init` method isn't valid. – rmaddy Sep 20 '17 at 03:24
  • Try this `@property(nonatomic, strong) NSString *folderIdentification;` – Torongo Sep 20 '17 at 04:10

0 Answers0