GNSMessage Sınıfı
Koleksiyonlar ile düzeninizi koruyun
İçeriği tercihlerinize göre kaydedin ve kategorilere ayırın.
Mesaj, yakındaki cihazlar arasında teslim edilen yayınlanmış bir nesnedir.
Mesajlar yalnızca aynı Apiary Geliştirici Konsolu Kimliğini paylaşan uygulamalar arasında teslim edilir. https://code.google.com/apis/console/ adresine bakın.
Mesajın bir türü de vardır. Bu tür, yayınlanan mesajı aboneliklerle eşleştirmek için kullanılır.
- Aşağıdaki kaynakları da incelemenizi öneririz:
Yayınlar ve abonelikler hakkında daha fazla bilgi edinmek için - GNSMessageManager sayfasına göz atın.
NSObject öğesini devralır.
|
((unavailable("Use
+messageWithContent.") | - __attribute__ |
|
+ (instancetype) messageWithContent: |
|
(NSData *) |
content |
|
Varsayılan türde mesaj.
- Aşağıdaki kaynakları da incelemenizi öneririz:
content hakkında daha fazla bilgi edinmek için - GNSMessage.content sayfasına göz atın.
- (NSString*) messageNamespace |
|
readnonatomiccopy |
Mesaj türünün ad alanıdır.
Boş dize varsayılan ad alanıdır ve her uygulamaya (veya bir Google Developers Console projesini paylaşan uygulamalara) özeldir. Şu anda yalnızca işaretçi eklerinin varsayılan dışında bir ad alanına sahip olacağını unutmayın.
Mesajın türü.
kGNSMessageMaxLength Unicode karakterlerinden uzun olamaz. Daha uzun bir türün kullanılması, onaylamaların etkinleştirilmesi durumunda kitaplığın onay vermesine neden olur ve onaylar devre dışı bırakılırsa mesajı yayınlamaz.
Mesajın içeriği.
Verilerin biçimi uygulamaya özgüdür ve tüm veri yayıncıları ve aboneleri tarafından kabul edilmelidir. kGNSMessageMaksimumContentSize değerinden uzun olamaz. Bundan daha büyük bir nesnenin kullanılması, kitaplığın onaylar etkinleştirildiğinde onay vermesine, onaylar devre dışıysa mesajın yayınlanmamasına neden olur.
Aksi belirtilmediği sürece bu sayfanın içeriği Creative Commons Atıf 4.0 Lisansı altında ve kod örnekleri Apache 2.0 Lisansı altında lisanslanmıştır. Ayrıntılı bilgi için Google Developers Site Politikaları'na göz atın. Java, Oracle ve/veya satış ortaklarının tescilli ticari markasıdır.
Son güncelleme tarihi: 2025-08-13 UTC.
[null,null,["Son güncelleme tarihi: 2025-08-13 UTC."],[[["\u003cp\u003eThe \u003ccode\u003eGNSMessage\u003c/code\u003e class facilitates communication between nearby devices by publishing and delivering messages between apps sharing the same Apiary Dev Console ID.\u003c/p\u003e\n"],["\u003cp\u003eMessages have a content and type, allowing applications to filter and process relevant messages; content is application-specific, while type enables matching with subscriptions.\u003c/p\u003e\n"],["\u003cp\u003eYou can create messages using class methods \u003ccode\u003emessageWithContent:\u003c/code\u003e for the default type, or \u003ccode\u003emessageWithContent:type:\u003c/code\u003e to specify a custom type.\u003c/p\u003e\n"],["\u003cp\u003eMessages are restricted in size: type cannot exceed \u003ccode\u003ekGNSMessageMaximumLength\u003c/code\u003e Unicode characters and content cannot be larger than \u003ccode\u003ekGNSMessageMaximumContentSize\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eThe message namespace, primarily used for beacon attachments, defaults to an empty string and is private to apps or apps sharing a Google Developer Console project.\u003c/p\u003e\n"]]],["The GNSMessage class manages messages delivered between nearby devices within the same app or apps sharing an ID. Messages have content, a type, and a namespace. Key actions include creating messages using class methods: `messageWithContent:` for the default type and `messageWithContent:type:` for a specified type. Properties include `messageNamespace`, `type`, and `content`, which hold the message's namespace, type, and data, respectively. Message size and type length have limits.\n"],null,["# GNSMessage Class\n\n[Instance Methods](#pub-methods) \\| [Class Methods](#pub-static-methods) \\| [Properties](#properties) \nGNSMessage Class Reference \n\nOverview\n--------\n\nA message is a published object that is delivered between nearby devices.\n\nMessages are delivered only between apps sharing the same Apiary Dev Console ID. See \u003chttps://code.google.com/apis/console/\u003e\n\nA message also has a type, which is used to match a published message with subscriptions.\n\nSee also\n: [GNSMessageManager](/nearby/messages/ios/reference/interface_g_n_s_message_manager \"The message manager lets you create publications and subscriptions. \") for more information about publications and subscriptions.\n\nInherits NSObject.\n\n|-------------------------------------------|---------------------|\n| Instance Method Summary ----------------------- ||\n| ((unavailable(\"Use +messageWithContent.\") | - **__attribute__** |\n| ||\n\n|----------------|------------------------------------------------------------------------------------------------------------------------|\n| Class Method Summary -------------------- ||\n| (instancetype) | + [messageWithContent:](/nearby/messages/ios/reference/interface_g_n_s_message#a11c95fc8aa716759a95b46ac2d9658b5) |\n| | Message with the default type. [More...](#a11c95fc8aa716759a95b46ac2d9658b5) |\n| ||\n| (instancetype) | + [messageWithContent:type:](/nearby/messages/ios/reference/interface_g_n_s_message#a86840561e1ebbcb98ad209adc110fb74) |\n| | Message with the specified type. [More...](#a86840561e1ebbcb98ad209adc110fb74) |\n| ||\n\n|-------------|--------------------------------------------------------------------------------------------------------------|\n| Property Summary ---------------- ||\n| NSString \\* | [messageNamespace](/nearby/messages/ios/reference/interface_g_n_s_message#aad0830d118becf213310c83b279bf0a6) |\n| | The namespace of the message type. [More...](#aad0830d118becf213310c83b279bf0a6) |\n| ||\n| NSString \\* | [type](/nearby/messages/ios/reference/interface_g_n_s_message#a20d9593b44edfbfa78e4d4416d8a2a1c) |\n| | The type of the message. [More...](#a20d9593b44edfbfa78e4d4416d8a2a1c) |\n| ||\n| NSData \\* | [content](/nearby/messages/ios/reference/interface_g_n_s_message#abd1454b18947ac01b56ac926ff9e6626) |\n| | The content of the message. [More...](#abd1454b18947ac01b56ac926ff9e6626) |\n| ||\n\nMethod Detail\n-------------\n\n|--------------------------------------|---|-------------|-----------|---|\n| + (instancetype) messageWithContent: | | (NSData \\*) | *content* | |\n\nMessage with the default type.\n\nSee also\n: [GNSMessage.content](/nearby/messages/ios/reference/interface_g_n_s_message#abd1454b18947ac01b56ac926ff9e6626 \"The content of the message. \") for more information about the [content](/nearby/messages/ios/reference/interface_g_n_s_message#abd1454b18947ac01b56ac926ff9e6626 \"The content of the message. \"). \n\n|----------------------------------------------------------------------------------------------------------------------------------|---|---------------|-----------|\n| + (instancetype) [messageWithContent:](/nearby/messages/ios/reference/interface_g_n_s_message#a11c95fc8aa716759a95b46ac2d9658b5) | | (NSData \\*) | *content* |\n| type: | | (NSString \\*) | *type* |\n| | | | |\n\nMessage with the specified type.\n\nSee also\n: [GNSMessage.content](/nearby/messages/ios/reference/interface_g_n_s_message#abd1454b18947ac01b56ac926ff9e6626 \"The content of the message. \") for more information about the [content](/nearby/messages/ios/reference/interface_g_n_s_message#abd1454b18947ac01b56ac926ff9e6626 \"The content of the message. \").\n:\n [GNSMessage.type](/nearby/messages/ios/reference/interface_g_n_s_message#a20d9593b44edfbfa78e4d4416d8a2a1c \"The type of the message. \") for more information about the [type](/nearby/messages/ios/reference/interface_g_n_s_message#a20d9593b44edfbfa78e4d4416d8a2a1c \"The type of the message. \").\n\nProperty Detail\n---------------\n\n|-------------------------------------------------------------------------|-------------------|\n| |---------------------------------| | - (NSString\\*) messageNamespace | | readnonatomiccopy |\n\nThe namespace of the message type.\n\nThe empty string is the default namespace, and is private to each app (or apps sharing a Google Developer Console project). Note that currently, only beacon attachments will have a namespace other than the default. \n\n|-------------------------------------------------|-------------------|\n| |---------------------| | - (NSString\\*) type | | readnonatomiccopy |\n\nThe type of the message.\n\nCannot be longer than kGNSMessageMaximumLength Unicode characters. Attempting to use a longer type will cause the library to assert if assertions are enabled and not publish the message if assertions are disabled. \n\n|---------------------------------------------------|-------------------|\n| |----------------------| | - (NSData\\*) content | | readnonatomiccopy |\n\nThe content of the message.\n\nThe format of the data is application-specific, and must be agreed upon by all publishers and subscribers of the data. Cannot be longer than kGNSMessageMaximumContentSize. Attempting to use an object larger than this will cause the library to assert if assertions are enabled and not publish the message if assertions are disabled."]]