我有一个Java应用程序,需要知道它的实例ID。 如何使用google-cloud-java库执行此操作?
在Go中,这非常简单:
func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [UIImagePickerController.InfoKey : Any]) {
guard let image1 = info[UIImagePickerController.InfoKey.originalImage]
as? UIImage else {
return
}
print(image1)
// firstImg.image = image1 as UIImage
if addAttachBtn1.isSelected == true{
firstImg.image = image1 as UIImage
}else if addAttach2.isSelected == true{
secondImg.image = image1 as UIImage
}else if addAttach3.isSelected{
thirdImg.image = image1 as UIImage
}else if addAttach4.isSelected{
fourthImg.image = image1 as UIImage
}else{
fifthImg.image = image1
}
dismiss(animated:true, completion: nil)
}
答案 0 :(得分:2)
String instanceId = com.google.cloud.MetadataConfig.getInstanceId()