Hi,
The above code generates runtime error, how to correct it ? Thanks.
-------------------------
Application_Start
Application_Active
Error occurred on line: 51 (Main)
-[__NSCFNumber timeIntervalSinceReferenceDate]: unrecognized selector sent to instance 0x15ddee70
Stack Trace: (
CoreFoundation <redacted> + 150
libobjc.A.dylib objc_exception_throw + 38
CoreFoundation <redacted> + 0
CoreFoundation <redacted> + 702
CoreFoundation _CF_forwarding_prep_0 + 24
Foundation <redacted> + 1582
B4i Example -[b4i_main setlastmodifiedtime::] + 326
CoreFoundation <redacted> + 68
CoreFoundation <redacted> + 292
B4i Example +[B4I runDynamicMethod:method:throwErrorIfMissing:args:] + 1780
B4i Example -[B4INativeObject RunMethod::] + 158
B4i Example -[b4i_main _icsetlastmodified:::] + 1294
B4i Example -[b4i_main _page1_resize::] + 2670
CoreFoundation <redacted> + 68
CoreFoundation <redacted> + 292
B4i Example +[B4I runDynamicMethod:method:throwErrorIfMissing:args:] + 1780
B4i Example -[B4IShell runMethod:] + 574
B4i Example -[B4IShell raiseEventImpl:method:args::] + 2212
B4i Example -[B4IShellBI raiseEvent:event
arams:] + 1442
B4i Example +[B4IObjectWrapper raiseEvent:::] + 220
B4i Example __30-[B4IPanelView layoutSubviews]_block_invoke + 1040
libdispatch.dylib <redacted> + 10
libdispatch.dylib <redacted> + 22
libdispatch.dylib _dispatch_main_queue_callback_4CF + 1532
CoreFoundation <redacted> + 8
CoreFoundation <redacted> + 1590
CoreFoundation CFRunLoopRunSpecific + 516
CoreFoundation CFRunLoopRunInMode + 108
GraphicsServices GSEventRunModal + 160
UIKit UIApplicationMain + 144
B4i Example main + 108
libdyld.dylib <redacted> + 2
)
'Code module
#Region Project Attributes
#ApplicationLabel: B4i Example
#Version: 1.0.0
'Orientation possible values: Portrait, LandscapeLeft, LandscapeRight and PortraitUpsideDown
#iPhoneOrientations: Portrait, LandscapeLeft, LandscapeRight
#iPadOrientations: Portrait, LandscapeLeft, LandscapeRight, PortraitUpsideDown
#Target: iPhone, iPad
#MinVersion: 7
#End Region
Sub Process_Globals
'These global variables will be declared once when the application starts.
'Public variables can be accessed from all modules.
Public App As Application
Public NavControl As NavigationController
Private Page1 As Page
End Sub
Private Sub Application_Start (Nav As NavigationController)
NavControl = Nav
Page1.Initialize("Page1")
Page1.Title = "Page 1"
Page1.RootPanel.Color = Colors.White
NavControl.ShowPage(Page1)
End Sub
Private Sub Page1_Resize(Width As Int, Height As Int)
Dim n As String
Dim o As OutputStream
Dim b(1024) As Byte
n = "test"
o = File.OpenOutput(File.DirTemp, n, False)
o.WriteBytes(b, 0, b.Length)
o.Close
icSetLastModified(File.DirTemp, n, DateTime.DateParse("02/23/2007"))
Msgbox(DateTime.Date(File.LastModified(File.DirTemp, n)), "")
End Sub
Sub icSetLastModified(Dir As String, FileName As String, DT As Long) As Boolean
Dim no As NativeObject = Me
Return no.RunMethod("setlastmodifiedtime::", Array(File.Combine(Dir, FileName), DT)).AsBoolean
End Sub
#if objc
- (BOOL)setlastmodifiedtime: (NSString*) target :(long long) dt {
NSDictionary *attr = [NSDictionary dictionaryWithObjectsAndKeys: @(dt), NSFileModificationDate, NULL];
return [[NSFileManager defaultManager] setAttributes: attr ofItemAtPath: target error: NULL];
}
#end if