Xamarin.Forms.GoogleMaps icon indicating copy to clipboard operation
Xamarin.Forms.GoogleMaps copied to clipboard

Error building IOS app using v. 3.3.0

Open mikthemonster opened this issue 5 years ago • 53 comments

VERSIONS

  • Xamarin.Forms.GoogleMaps - 3.3.0
  • Xamarin.Forms -4.3.0.908675

PLATFORMS

  • [ ] Android
  • [x] iOS
  • [ ] UWP

ACTUAL BEHAVIOR

After updating Xamarin.Forms.GoogleMaps from version 3.2.1 to 3.3.0 our build server (Visual Studio App Center) fails to build for IOS. We get the following error:

MTOUCH : error MT2101: Can't resolve the reference 'Foundation.NSArray Foundation.NSArray::FromNSObjects(!!0[])', referenced from the method 'System.Void Google.Maps.Polyline::set_Spans(Google.Maps.StyleSpan[])' in 'Xamarin.iOS, Version=0.0.0.0, Culture=neutral, PublicKeyToken=84e04ff9cfb79065'. [/Users/runner/runners/2.159.2/work/1/s/iOS/WorkingWithMaps.iOS.csproj]

If I re-install v 3.2.1 the build is working, but as soon as I update to 3.3.0 the build fails.

mikthemonster avatar Oct 24 '19 12:10 mikthemonster

I have exactly the same issue after upgrading to 3.3.0

tonyfonager avatar Oct 24 '19 14:10 tonyfonager

Same problem here

Pietervdw avatar Oct 25 '19 06:10 Pietervdw

I'm not sure to is AppCenter supports latest iOS SDK and GoogleMaps SDK for iOS.

amay077 avatar Oct 25 '19 11:10 amay077

I just got this reply from AppCenter:

It seems that latest version of map was not supported by AppCenter that's why it was failed, I am forwarding this to our team and will update you when i will get any response from them.

mikthemonster avatar Oct 25 '19 12:10 mikthemonster

Actually I'm not using AppCenter in my App and few minutes ago I tried to update to v3.3.0. Same problem, the build process fails on iOS. I also tested a delete of bin and obj project folders but the problem remains.

After a simple downgrade of Xamarin.Forms.GoogleMaps package (only on iOS project) the app returned to build and work correctly.

My Xcode version is 11.1 (I don't use any preview version, only stable releases).

Following is a error from build log I think is responsible of the problem:

ld : warning : directory not found for option '-FGMps-3.5.0/Maps/Frameworks'
ld : warning : directory not found for option '-FGMps-3.5.0/Maps/Frameworks'
ld : warning : directory not found for option '-FGMps-3.5.0/Base/Frameworks'
MTOUCH : warning MT5215: References to 'System' might require additional -framework=XXX or -lXXX instructions to the native linker
clang : error : linker command failed with exit code 1 (use -v to see invocation)
error MT5209 : Native linking error : warning: directory not found for option '-FGMps-3.5.0/Maps/Frameworks'
error MT5209 : Native linking error : warning: directory not found for option '-FGMps-3.5.0/Maps/Frameworks'
error MT5209 : Native linking error : warning: directory not found for option '-FGMps-3.5.0/Base/Frameworks'
error MT5209 : Native linking error : framework not found GoogleMaps
MTOUCH : error MT5201: Native linking failed. Please review the build log and the user flags provided to gcc: -ObjC -ObjC -ObjC -lc++ -lz
MTOUCH : error MT5202: Native linking failed. Please review the build log.

I tested all the link options availble: Don't Link, Link framework and SDKs Only, Link all. No differences.

simonemarra avatar Oct 25 '19 15:10 simonemarra

I have the same error as @simonemarra. i even tried using the solutions from Microsoft documentation (which can be seen here). Im looking forward for a solution. Thanks in advance! :)

Bustillox avatar Oct 25 '19 23:10 Bustillox

+1

czenzel avatar Oct 26 '19 05:10 czenzel

+1

katkusmt avatar Oct 28 '19 12:10 katkusmt

MTOUCH : error MT2101: Can't resolve the reference 'Foundation.NSArray Foundation.NSArray::FromNSObjects(!!0[])', referenced from the method 'System.Void Google.Maps.Polyline::set_Spans(Google.Maps.StyleSpan[])' in 'Xamarin.iOS, Version=0.0.0.0, Culture=neutral, PublicKeyToken=84e04ff9cfb79065'. [/Users/runner/runners/2.159.2/work/1/s/iOS/WorkingWithMaps.iOS.csproj]

  1. Try to target ios project 9.0+ version. I am targeted to 10
  2. Add Xamarin.Build.Download package to ios project
  3. clean and rebuild

jocontacter avatar Oct 30 '19 16:10 jocontacter

ld : warning : directory not found for option '-FGMps-3.5.0/Maps/Frameworks'

check my answer

jocontacter avatar Oct 30 '19 17:10 jocontacter

Adding the Xamarin.Build.Download NuGet package to my iOS project, as suggested by @jocontacter, was the solution. The project now builds on both my local machine and on AppCenter

Pietervdw avatar Oct 31 '19 05:10 Pietervdw

I add the Xamarin.Build.Download NuGet package to my iOS project but have these problem

'GMps-3.5.0\Base\Frameworks\GoogleMapsBase.framework' could not be found.

'GMps-3.5.0\Maps\Frameworks\GoogleMaps.framework' could not be found.

'GMps-3.5.0\Maps\Frameworks\GoogleMapsCore.framework' could not be found.

amnso avatar Oct 31 '19 08:10 amnso

It worked for me!!! thank you @jocontacter

simonemarra avatar Oct 31 '19 08:10 simonemarra

@simonemarra Can you share simple ?

amnso avatar Oct 31 '19 08:10 amnso

I add the Xamarin.Build.Download NuGet package to my iOS project but have these problem

'GMps-3.5.0\Base\Frameworks\GoogleMapsBase.framework' could not be found.

'GMps-3.5.0\Maps\Frameworks\GoogleMaps.framework' could not be found.

'GMps-3.5.0\Maps\Frameworks\GoogleMapsCore.framework' could not be found.

try to target ios project 9.0+

jocontacter avatar Oct 31 '19 09:10 jocontacter

How do you target ios project 9.0+ when using app center?

mikthemonster avatar Oct 31 '19 10:10 mikthemonster

How do you target ios project 9.0+ when using app center?

I don't use the appcenter, but i think there is the same: edit info.plist

jocontacter avatar Oct 31 '19 10:10 jocontacter

After deleting the bin/obj of all projects and adding the Build Nuget to every project and targetted iOS 9 in the info.plist it worked for me.

Note: I had to add the NuGet to all my projects.

ianvink avatar Oct 31 '19 16:10 ianvink

After deleting the bin/obj of all projects and adding the Build Nuget to every project and targetted iOS 9 in the info.plist it worked for me.

Note: I had to add the NuGet to all my projects.

now, after all of this, if you remove X.B.D package from .netstandard lib, your project will not be compiled? just interesting

jocontacter avatar Oct 31 '19 19:10 jocontacter

I still get the same build error in Visual Studio App Center. I tried all the suggestions:

I changed my Info.Plist (from 9.0 to 10.0):

MinimumOSVersion 10.0

And added Xamarin.Build.Download to all Xamarin projects.

Still the same error: MTOUCH : error MT2101: Can't resolve the reference 'Foundation.NSArray Foundation.NSArray::FromNSObjects(!!0[])', referenced from the method 'System.Void Google.Maps.Polyline::set_Spans(Google.Maps.StyleSpan[])' in 'Xamarin.iOS, Version=0.0.0.0, Culture=neutral, PublicKeyToken=84e04ff9cfb79065'.

mikthemonster avatar Nov 01 '19 09:11 mikthemonster

I still get the same build error in Visual Studio App Center. I tried all the suggestions:

I changed my Info.Plist (from 9.0 to 10.0):

MinimumOSVersion 10.0

And added Xamarin.Build.Download to all Xamarin projects.

Still the same error: MTOUCH : error MT2101: Can't resolve the reference 'Foundation.NSArray Foundation.NSArray::FromNSObjects(!!0[])', referenced from the method 'System.Void Google.Maps.Polyline::set_Spans(Google.Maps.StyleSpan[])' in 'Xamarin.iOS, Version=0.0.0.0, Culture=neutral, PublicKeyToken=84e04ff9cfb79065'.

try >=12

jocontacter avatar Nov 05 '19 11:11 jocontacter

Hi! I'm still having issues using iOS13.2 and XCode 11.2 (11B52). The app don't load correctly the maps, it has too much bugs, etc...

I don't know what is happening, but at the moment I downgraded my Xamarin.Forms.GoogleMaps version to 3.2.1 and it works correctly.

@amay077 at the moment I cannot manage to write down all the bugs using the last release version, and I don't know if it could be a good idea to try to update the Xamarin.Forms.GoogleMaps package if Apple doesn't stop to release updates on iOS at the same speed as I debug my App code (iOS13.2 was released before to have a Xcode stable version compatible!!!)

simonemarra avatar Nov 06 '19 08:11 simonemarra

I finally found a solution to my problem:

In Microsoft App Center there is a setting: “SDK version”. An old version was selected but as soon as I changed it to the latest version (13.4) it worked :-)

solution

mikthemonster avatar Nov 06 '19 09:11 mikthemonster

To resolve the problem your setting as following steps

  • Downloaded Xamarin.Forms.GoogleMaps version 3.3.0

  • Downloaded Xamarin.Google.IOS.Maps version 3.5.0

  • Downloaded Xamarin.Build.Download version 0.4.11

  • Open Info.plist

  • in Deployment Info option

  • make Deployment Target Equal to 9.0

it work for me correctly

yahiaalnaqeeb avatar Nov 25 '19 21:11 yahiaalnaqeeb

Nothing worked for me until I updated to VS 2019 from VS 2017 and updated VS for Mac.

MrMiso avatar Nov 28 '19 15:11 MrMiso

I get this one: nuget/packages/xamarin.build.download/0.4.11/build/Xamarin.Build.Download.targets(74,3): error : Did not find reference matching RestoreAssemblyResources AssemblyName metadata 'Google.Maps, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' Done building project "" -- FAILED.

Sigve84 avatar Dec 01 '19 16:12 Sigve84

I have the same problem with Xamarin.Build.Download.targets (0.4.11) or the last version.

  • I clean Nugget cache
  • Delete bin/obj folder
  • Clean solution
  • Check Deployment >= 9.0

But I always have this error : nuget/packages/xamarin.build.download/0.4.11/build/Xamarin.Build.Download.targets(74,3): error : Did not find reference matching RestoreAssemblyResources AssemblyName metadata 'Google.Maps, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'

kidhaxx avatar Dec 06 '19 11:12 kidhaxx

any update ?

laitauchocolat avatar Dec 12 '19 19:12 laitauchocolat

Same issue, always get nuget/packages/xamarin.build.download/0.4.11/build/Xamarin.Build.Download.targets(74,3): error : Did not find reference matching RestoreAssemblyResources AssemblyName metadata 'Google.Maps, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'

AlonikiX avatar Dec 13 '19 02:12 AlonikiX

Hi all, I think I have found a solution. If you check /Users/YOUR_USER_NAME/.nuget/packages/xamarin.google.ios.maps/3.5.0/lib/xamarinios10/Google.Maps.dll, the file size may be 0, and that's why the program couldn't load this dll.

Here is the steps to fix this issue:

  1. Run the sample project, you should see a valid dll at /Xamarin.Forms.GoogleMaps-master/XFGoogleMapSample/packages/Xamarin.Google.iOS.Maps.3.5.0/lib/xamarinios10/Google.Maps.dll
  2. Copy this dll, paste it to /Users/YOUR_USER_NAME/.nuget/packages/xamarin.google.ios.maps/3.5.0/lib/xamarinios10/Google.Maps.dll
  3. Open your project, add Xamarin.Forms.GoogleMaps to your .netstandard project, and Xamarin.Forms.GoogleMaps and Xamarin.Google.iOS.Maps and Xamarin.Build.Download(v0.4.11) to your .iOS project.
  4. Clean and Rebuild your project
  5. Sometimes you may need to delete your packages folder and all bin and obj and restart everything
  6. Run the app

It works well in my case, hope it will be helpful for you : )

AlonikiX avatar Dec 13 '19 04:12 AlonikiX