简体   繁体   中英

Native linking failed, undefined symbol error. Xamarin Forms PCL iOS Visual Studio

I started working on the iOS implemenatation of my PCL app in xamarin and encountered a problem that I can't seem to find a fix for in Google.

The problem is that the moment I linked my Entitlement.plist file (iOS project> Bundle signing > Custom Entitlements) I'm getting quite a few Native linking failed errors. I've set linker behavior to all 3 possibilities no luck. I also tried it with empty dict tags in the entitlement.plist , with different linker behavior, mtouch arguments,... the profiles/licenses/provisioning profiles/identities should also be fine.

the entitlements.plist contains the following (prefix and the id from dev.apple.com App ID's)

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" 
"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>application-identifier</key>
    <string>myidprefix.com.mycompany.*</string>
    <key>get-task-allow</key>
    <false/>
    <key>keychain-access-groups</key>
    <array>
        <string>$(AppIdentifierPrefix)myidprefix.com.mycompany.*</string>
    </array>
</dict>
</plist>

Error screenshot here

Obviously I can tell it has something to do with Android stuff, I can get around it by unloading my Android project but in my PCL I can't avoid using Mono.Android which I think is causing all of this?

Any help would be appreciated!

Project / versions info:

  • Mac server host OS: macOS Sierra 10.12
  • VS 2015 Enterprise

I'm putting in answer because I need to attach some image.

You should not reference to Mono.Android in your PCL. A PCL should be shared among Android and iOS and contain codes that usable in both Android and iOS. You should create another Android class library project and put your Android specific code into it. 在此处输入图片说明

Another option is instead of using PCL, you can use "Shared Project" type. Then control in the shared project with compiler directives (#if ANDROID ) for the UI specific codes. 在此处输入图片说明

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM