ExportImage method not found in Swift 3.0

1553
6
11-22-2016 06:39 AM
JayMehta
New Contributor

Hello Team ,

Xcode : 8.0

Swift : 3.0

I am not able to find "exportImage" method ,

i am not getting the method in intelli-sense of xcode

self.mapView.exportImage { [weak self] (image:UIImage?, error:NSError?) -> Void in

           if error != nil{

               UIAlertView(title: "Error", message: error.localizedDescription, delegate: nil, cancelButtonTitle: "Ok").show()

           }

           if let image = image {

               //on completion imitate flash

//                self?.imitateFlash(image)

           }

       }

did import any thing in file i import only ArcGIS?

let me know your suggestion.

Tags (3)
0 Kudos
6 Replies
RyanOlson1
Esri Contributor

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!")

            }

        })

```

0 Kudos
JayMehta
New Contributor

We have already try this method in swift 3.0 but it is not working. Let me know alternative solution 

Here below i have attached screen shots of that method


  "mapView.exportImage { (image, error) in"

0 Kudos
RyanOlson1
Esri Contributor

Is your project settings set to use swift 3.0 or swift 2.3?

0 Kudos
JayMehta
New Contributor

Hi

Project setting use swift 3.0

We have used xcode 8.0

0 Kudos
YueWu1
by
Regular Contributor

Hi Jay,

Make sure to re-wire our framework and import a new ArcGIS Bundle in Xcode based on our doc: 

Install and set up—ArcGIS Runtime SDK for iOS | ArcGIS for Developers 

$(HOME)/Library/SDKs/ArcGIS/iOS/Frameworks/Static

0 Kudos
RyanOlson1
Esri Contributor

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?

0 Kudos