<!--
{
  "availability" : [
    "iOS: 10.0.0 -",
    "iPadOS: 10.0.0 -",
    "macCatalyst: 13.1.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Messages",
  "identifier" : "/documentation/Messages/MSMessageErrorCode",
  "metadataVersion" : "0.1.0",
  "role" : "Enumeration",
  "symbol" : {
    "kind" : "Enumeration",
    "modules" : [
      "Messages"
    ],
    "preciseIdentifier" : "c:@E@MSMessageErrorCode"
  },
  "title" : "MSMessageErrorCode"
}
-->

# MSMessageErrorCode

The error codes that the Messages framework generates.

```
enum MSMessageErrorCode
```

## Topics

### Error Codes

[`case fileNotFound`](/documentation/Messages/MSMessageErrorCode/fileNotFound)

The file could not be found.

[`case fileUnreadable`](/documentation/Messages/MSMessageErrorCode/fileUnreadable)

The file could not be read.

[`case improperFileType`](/documentation/Messages/MSMessageErrorCode/improperFileType)

The file is not a supported file type.

[`case improperFileURL`](/documentation/Messages/MSMessageErrorCode/improperFileURL)

The URL does not refer to a local file.

[`case stickerFileImproperFileAttributes`](/documentation/Messages/MSMessageErrorCode/stickerFileImproperFileAttributes)

The system cannot read one or more of the file’s attributes (for example, the file size).

[`case stickerFileImproperFileSize`](/documentation/Messages/MSMessageErrorCode/stickerFileImproperFileSize)

The image used to create an [`MSSticker`](/documentation/Messages/MSSticker) object is larger than 500 KB.

[`case stickerFileImproperFileFormat`](/documentation/Messages/MSMessageErrorCode/stickerFileImproperFileFormat)

The image used to create an [`MSSticker`](/documentation/Messages/MSSticker) object is not one of the supported file types (PNG, APNG, GIF, or JPEG).

[`case urlExceedsMaxSize`](/documentation/Messages/MSMessageErrorCode/urlExceedsMaxSize)

The URL in an [`MSMessage`](/documentation/Messages/MSMessage) object’s [`url`](/documentation/Messages/MSMessage/url) property is longer than the maximum allowed length (5,000 characters).

[`case sendWhileNotVisible`](/documentation/Messages/MSMessageErrorCode/sendWhileNotVisible)

A message was sent while the app was not visible.

[`case sendWithoutRecentInteraction`](/documentation/Messages/MSMessageErrorCode/sendWithoutRecentInteraction)

A message was sent, but the app has not registered a recent touch interaction from the user.

[`case apiUnavailableInPresentationContext`](/documentation/Messages/MSMessageErrorCode/apiUnavailableInPresentationContext)

The API is unavailable in the current context.

[`case unknown`](/documentation/Messages/MSMessageErrorCode/unknown)

An unexpected or unknown error has occurred.

### Initializers

[`init?(rawValue: Int)`](/documentation/Messages/MSMessageErrorCode/init(rawValue:))

## Relationships

### Conforms To

[`SendableMetatype`](/documentation/Swift/SendableMetatype)

[`Equatable`](/documentation/Swift/Equatable)

[`BitwiseCopyable`](/documentation/Swift/BitwiseCopyable)

[`RawRepresentable`](/documentation/Swift/RawRepresentable)

[`Sendable`](/documentation/Swift/Sendable)

[`Hashable`](/documentation/Swift/Hashable)

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)