POST
|
SBJson was a third party library that has no longer been necessary the last few years now that Apple has shipped NSJSONSerialization. Objects that support AGSJSONSerializable have a toJSON method you can call. That will give you a JSON object (most likely an NSDictionary, but could be an NSArray). You can use that JSON object with NSJSONSerialization to get NSData: AGSObject -> NSDictionary -> NSJSONSerialization -> NSData You can also go the other way if you have NSData: NSData -> NSJSONSerialization -> NSDictionary -> AGSObject Here is sample code showing you how to do both: -(void)testJSONSerialization{
// Example 1: AGSPoint to NSData of JSON string...
//
AGSPoint *point = [AGSPoint pointWithX:34 y:-117 spatialReference:[AGSSpatialReference WGS84]];
id jsonObject = [point toJSON:nil];
NSData *data = [NSJSONSerialization dataWithJSONObject:jsonObject options:0 error:nil];
// do whatever you want with the NSData...
// ...
// ...
// For example print out a json string:
NSLog(@"the json string: %@", [[NSString alloc]initWithData:data encoding:NSUTF8StringEncoding]);
// Example 2: NSData of JSON String to AGSPoint
//
id jsonObject2 = [NSJSONSerialization JSONObjectWithData:data options:0 error:nil];
AGSPoint *point2 = (AGSPoint*)[AGSPoint fromJSON:jsonObject2 error:nil];
// print out and test for equality
NSLog(@"point1: %@", point);
NSLog(@"point2: %@", point2);
NSAssert([point isEqualToGeometry:point2], @"point comparison failed...");
}
... View more
12-12-2016
08:56 AM
|
0
|
1
|
248
|
POST
|
Maximo Mobile, We are going to be releasing some 10.2.5 Objective-C sample code that has been ported to version 100.0.0. A potentially very helpful aspect of this will be that you will be able to easily run a diff between the 10.2.5 sample code and the v100.0.0 sample code as they will both be in a github repository. Stay tuned - we are working very hard to get this out ASAP. thanks
... View more
12-06-2016
08:51 AM
|
0
|
2
|
765
|
POST
|
here is a decent thread on the topic: App Transport Security REQUIRED January 2017 | Apple Developer Forums
... View more
12-06-2016
08:38 AM
|
0
|
0
|
414
|
POST
|
The only thing I can think of is that you are somehow referencing an old version of the sdk. Have you followed the steps in the documentation for setting up your project with the 100.0.0 version of the framework?
... View more
12-02-2016
08:40 AM
|
0
|
0
|
730
|
POST
|
Is your project settings set to use swift 3.0 or swift 2.3?
... View more
12-01-2016
10:34 AM
|
0
|
2
|
730
|
POST
|
With swift 3 the code would look like this to do a query against a ServiceFeatureTable. Make sure to hold a reference to the ServiceFeatureTable so that it doesn't go out of scope and get deallocd before the request is finished. sft = AGSServiceFeatureTable(url: URL(string: "https://sampleserver3.arcgisonline.com/ArcGIS/rest/services/SanFrancisco/311Incidents/FeatureServer/0")!)
sft.featureRequestMode = .onInteractionNoCache
let qp = AGSQueryParameters()
qp.whereClause = "req_type = 'Sidewalk and Curb Issues'"
sft.queryFeatures(with: qp, fields: .loadAll){ result, error in
if let error = error {
print("error querying: \(error)")
}
else{
print("result: \(result)")
let enumerator = result?.featureEnumerator()
while let feature = enumerator?.nextObject(){
print("feature: \(feature)")
}
}
}
... View more
11-22-2016
03:01 PM
|
1
|
0
|
365
|
POST
|
Nicholas is correct. The other thing is with Quartz you may not need to know when your layer loads - depending on why you were listening for the load delegate. If it was for authentication purposes then the new AGSAuthenticationManager will handle that for you.
... View more
11-22-2016
02:25 PM
|
1
|
0
|
277
|
POST
|
Also - when you assign the map to the mapView - the mapView will start loading the map. If you were to call loadWithCompletion anytime after that, it's totally fine. It will either call back immediately if loading was done or failed or it will wait for currently in progress load to happen and call you back.
... View more
11-22-2016
02:10 PM
|
1
|
0
|
366
|
POST
|
James, The `AGSMap` class is `AGSLoadable`. This means you can call the `loadWithCompletion:` method on instances of `AGSMap` The AGSLoadable `loadWithCompetion` doc is this: ``` /** Loads data for the object asynchronously. The completion block is invoked upon completion. You can call this method any number of times, however only one attempt is made to load the data. If it is already loading, it will just continue to load (i.e. not force a reload). If it has already loaded successfully, the completion block will be invoked right away. If it has already failed to load, the completion block will be invoked right away with error previously encountered. This method supports multiple callers and will call them all back on completion. However, each caller's completion block will be invoked once and only once. @param completion block that is invoked when object loads successfully or fails to load. An error is passed to the block if the object fails to load. @since 100 @see `#cancelLoad` to cancel loading @see `#retryLoadWithCompletion:` to force reload */ ``` in swift 3 the code would look like so: ``` mapView.map?.load(){ error in if let error = error { print("error loading map: \(error)") } else{ print("map loaded successfully") } } ``` in objective-c: ``` [self.mapView.map loadWithCompletion:^(NSError * _Nullable error) { if (error){ NSLog(@"error loading: %@", error); } else{ NSLog(@"map loaded successfully"); } }]; ``` Many objects in 100.0.0 are AGSLoadable and have the same behavior.
... View more
11-22-2016
02:08 PM
|
1
|
0
|
366
|
POST
|
It has been removed in favor of KVO on the `drawStatus` property: ``` import UIKit import ArcGIS private var myKVOContext = 0 class ViewController: UIViewController { let mapView = AGSMapView(frame: CGRect.zero) override func viewDidLoad() { super.viewDidLoad() mapView.frame = view.bounds mapView.autoresizingMask = [.flexibleWidth, .flexibleHeight] view.addSubview(mapView) mapView.map = AGSMap(basemapType: .streets, latitude: 0, longitude: 0, levelOfDetail: 0) mapView.addObserver(self, forKeyPath: "drawStatus", options: .new, context: &myKVOContext) } override func observeValue(forKeyPath keyPath: String?, of object: Any?, change: [NSKeyValueChangeKey : Any]?, context: UnsafeMutableRawPointer?) { if context == &myKVOContext{ if keyPath == "drawStatus"{ print("drawStatus changed: \(mapView.drawStatus.rawValue)") } } else{ super.observeValue(forKeyPath: keyPath, of: object, change: change, context: context) } } } ```
... View more
11-22-2016
11:05 AM
|
1
|
0
|
380
|
POST
|
use the `attributionTextVisible` property instead now at final.
... View more
11-22-2016
10:57 AM
|
0
|
0
|
225
|
POST
|
James, There is a migration doc in progress. As soon as it is ready it will be made available. Also coming soon to github are the 10.2.x objective-c samples that have been ported to quartz so you can compare how to do things at 10.2.x to how you do the same in quartz. thanks, Ryan
... View more
11-22-2016
10:33 AM
|
1
|
1
|
210
|
POST
|
try this code for swift 3 ``` mapView.exportImage { (image, error) in if let error = error{ print("error: \(error)") } else if let image = image{ print("image exported!") } } ``` this for swift 2.3: ``` self.mapView?.exportImageWithCompletion({ (image, error) in if let error = error { print("error: \(error)") } else if let image = image{ print("success!") } }) ```
... View more
11-22-2016
10:17 AM
|
0
|
4
|
730
|
POST
|
Can you try turning hit-testing off on a per-layer basis to narrow down what layer is causing the crash?
... View more
07-18-2016
09:05 AM
|
0
|
3
|
789
|
Title | Kudos | Posted |
---|---|---|
1 | 12-04-2018 09:10 AM | |
1 | 07-08-2021 07:45 AM | |
1 | 06-14-2021 08:03 AM | |
1 | 06-09-2021 08:41 AM | |
1 | 11-22-2016 02:08 PM |
Online Status |
Offline
|
Date Last Visited |
10-21-2021
08:05 AM
|