var MyLocation as MapLocation
var MyLocArray() as MapLocation
try
for i as double = 1.0 to 49.0 step 0.5
MyLocation = New MapLocation(i, i, “MyLoc”)
MyLocArray.Add(MyLocation)
next
MapViewer1.AddLocation(MyLocArray)
Catch e
MessageBox CurrentMethodName + " Error: " + e.Message
end try
Was your intention something like this?
Catch e as InvalidArgumentException
MessageBox CurrentMethodName + " Error: " + e.Message
end try
Looking at your code, why are you trying to use the same exact identifier (MyLoc) over and over? My recollection is that they are supposed to be unique.
Also, are you sure that the exception you are getting is an InvalidArgumentException? If it’s something else (like NilObjectException) you’ll still crash.
Another possibility is that you’re hitting an uncaught NSException. Do you have a crash log that we could see? The first 100 lines should be fine.
You got this message from the core location, if your network is not available or you have send too many request to the apple map server (see this message on stackoverflow)
The same problem exists with UnsupportedOperationException.
Do you have break on exceptions enabled? If you do you’ll pause in the debugger when the exception happens but can then resume and the try/catch will let you continue. Pausing in the debugger doesn’t mean the app has fully crashed