iOS Question Get the last modified date in B4i

Discussion in 'iOS Questions' started by shasunder, Mar 10, 2015.

Similar threads

B4i Tutorial Background playback
B4i Tutorial Inline Objective C code
B4i Tutorial Background Fetch (Downloads)
B4i Code Snippet Full screen apps
B4i Tutorial iBeacons
B4i Code Snippet Msgbox with timeout
  1. shasunder

    shasunder Member Licensed User

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

    Code:
    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
    Code:
    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.
     
  2. Erel

    Erel Administrator Staff Member Licensed User

    Why don't you use File.LastModified?
     
  3. shasunder

    shasunder Member Licensed User

    I want to know the application recent installed / modified date. Is it possible using File.lastmodified?
     
  4. Erel

    Erel Administrator Staff Member Licensed User

    You can check the modified time of one of the asset files:
    Code:
    Msgbox(DateTime.Date(File.LastModified(File.DirAssets, "1.bil")), "")
     
    shasunder likes this.
  5. shasunder

    shasunder Member Licensed User

    Thanks Erel. That makes sense. Understood.
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice