iOS Question Get the last modified date in B4i

shasunder

Member
Licensed User
Longtime User
I am trying to get the last modified date in B4i. Using xcode the code is as below.

B4X:
NSString *pathToInfoPlist =[[NSBundle mainBundle] pathForResource:@"Info" ofType:@"plist"];
NSString *pathToAppBundle =[pathToInfoPlist stringByDeletingLastPathComponent];
NSDate *updateDate =[[[NSFileManager defaultManager] attributesOfItemAtPath:pathToAppBundle error:&error] objectForKey:NSFileModificationDate];

But how to do this using NativeObject. I tried as below
B4X:
Dim nativeMe As NativeObject = Me
   Log(nativeMe.RunMethod("getmodifieddate", Null).AsString)
End Sub

#If OBJC
- (NSString*) getmodifieddate {
NSString *pathToInfoPlist =[[NSBundle mainBundle] pathForResource:@"Info" ofType:@"plist"];
NSString *pathToAppBundle =[pathToInfoPlist stringByDeletingLastPathComponent];
NSDate *updateDate =[[[NSFileManager defaultManager] attributesOfItemAtPath:pathToAppBundle error:&error] objectForKey:NSFileModificationDate];
return updateDate;
}
#end if

Any help would be appreciated.
 
Top