Support Center

iOS :: Troubleshooting

  • Invalid Code Signing Entitlements

    If you're getting the following message:

    "Invalid Code Signing Entitlements - The signature for your app bundle contains entitlement values that are not supported. For the com.apple.developer.ubiquity-container-identifiers entitlement, the first value in the array must consist of the prefix provided by Apple in the provisioning profile followed by a bundle identifier suffix. The bundle identifier must match the bundle identifier for one of your apps or another app that you are permitted to use as the iCloud container identifier."

    then you will need to follow the instructions in this Stack Overflow question - http://stackoverflow.com/questions/6427735/invalid-code-signing-entitlements

  • How do I create outlets or actions with Interface Builder?

    You can find out how to create outlets and/or actions with Interface Builder from our iOS Getting Started guide on our documentation website here: http://docs.xamarin.com/ios/getting_started/Hello_iPhone#Adding_Outlets_and_Actions_to_the_UI.

  • System.Text.Encoding.GetEncoding throws NotSupportedException

    You're maybe using an encoding that is not added by default. Check the Internationalization page to learn how to add support for more encoding.

  • System.MissingMethodException (anything else)

    The member was likely removed by the linker, and thus doesn't exist in the assembly at runtime.  There are several solutions to this:

    • Add the [Preserve] attribute to the member.  This will prevent the linker from removing it.
    • When invoking mtouch, use the -nolink or -linksdkonly options.
      • -nolink disables all linking.
      • -linksdkonly will only link MonoTouch-provided assemblies, such as monotouch.dll.
    Note that assemblies are linked so that the resulting executable is smaller; thus, disabling linking may result in a larger executable than is desirable.

  • You are getting a ModelNotImplementedException

    If you are getting this exception this means that you are calling base.Method () on a class that overrides a Model. You do not need to call the base method in a class for models (these are classes that are flagged with the [Model] attribute).

  • NSUnknownKeyException - This class is not key value coding-compliant for the key XXXX

    This error occurs when you have initialized a ViewController in code but also have the ViewController initialized from a XIB file.

    This could happen if you have the "Main Interface" value set to a ViewController you're creating in code. To resolve this issue, make this value empty, then no ViewController will be initialized automatically.

  • Unknown class XXXX in Interface Builder file

    This error is generated if you define a class in your interface builder files but you do not provide the actual implementation for it in your C# code.

    You need to add some code like this:

    public partial class MyImageView : UIView {
       public MyImageView (IntPtr handle) : base (handle {}
    } 

  • System.MissingMethodException: No constructor found for Foo.Bar::ctor(System.IntPtr)

    This error is produced at runtime when the code tries to instantiate an instance of the classes that you referenced from your Interface Builder file. This means that you forgot to add a constructor that takes a single IntPtr as a parameter.

    The constructor with an IntPtr handle is used to bind managed objects with their unmanaged representations. To fix this, add the following line of code to the class Foo.Bar:

    public Bar (IntPtr handle) : base (handle) { }

  • Type {Foo} does not contain a definition for `GetNativeField' and no extension method `GetNativeField' of type {Foo} could be found

    If you get this error in the designer generated files (*.xib.designer.cs), it means one of two things:

    1) Missing partial class or base class

    The designer-generated partial classes must have corresponding partial classes in user code that inherit from some subclass of NSObject, often UIViewController. Ensure that you have such a class for the type that is giving the error.

    2) Default namespaces changed

    The designer files are generated using your project's default namespace settings. If you have changed these settings, or renamed the project, the generated partial classes may no longer be in the same namespace as their user-code counterparts.

    Namespace settings can be found in the Project Options dialog. The default namespace is found in the General->Main Settings section. If it is blank, the name of your project is used as the default. More advanced namespace settings can be found in the Source Code->.NET Naming Policies section.

  • Warning for actions: The private method 'Foo' is never used. (CS0169)

    Actions for interface builder files are connected to the widgets by reflection at runtime, so this warning is expected.
     
    You can use "#pragma warning disable 0169" "#pragma warning enable 0169" around your actions if you want to suppress this warning just for these methods, or add 0169 to the "Ignore warnings" field in compiler options if you want to disable it for your whole project (not recommended).