Перейти к содержанию
Fire Monkey от А до Я

Лидеры

Популярный контент

Показан контент с высокой репутацией 31.10.2015 во всех областях

  1. В топике старый протокол отправки пушей на ИОС. Не более 256 знаков, а с учетом юникода так вообще не более около 50 букв на русском!!! Переписал на новый 2-й протокол, чуток попапрился с байтами-битами ), но все же сделал. Теперь на русском можно около 400 букв, а на инглише как и разрешено около 2000. Это лучший ответ, но не хочу и первую версию снимать со счета...она ведь для ИОС ниже 8. Вообщем Enjoy : procedure TForm1.Button2Click(Sender: TObject); var i,j,p: integer; s,c,t,m: string; vStr: TStringStream; begin if not TCPClient.Connected then TCPClient.Connect; m := EscapeString(edMsg.Text); c := edToken.Text; t := ''; for i := 0 to (length(c) div 2) - 1 do t := t + AnsiChar(Byte(('$'+copy(c,i*2+1,2)).ToInteger)); s := '{"aps":{"alert":"'+ m +'","sound":"default","badge":0}}'; p := length(s); j := p + 38; s := #2#0#0 + AnsiChar(hi(j)) + AnsiChar(lo(j)) + #1#0#32 + t + #2 + AnsiChar(hi(p)) + AnsiChar(lo(p)) + s; vStr := TStringStream.Create(s); try SSLHandler.write(vStr); finally vStr.Free; end; end; p.s: нафиг 4 байта для общей длины...если дали разрешение на длину сообщения в 2 килобайта...
    1 балл
  2. After further reading, I was finally able to install the 'FGX' components onto my 'Delphi 10 Seattle' IDE. In case, it might help someone else, here is what I did (keeping in mind that I did have an older version of the components previously installed on my computer): After downloading the 'fgx_0.7.0.69.zip' file, I unzipped it into the following folder ('C:\Delphi 10 Seattle\Third-Party Tools\FGX 0.7.0.69'). Using a regular text editor, I opened the file named 'fgx.dproj' (located in my 'C:\Delphi 10 Seattle\Third-Party Tools\FGX 0.7.0.69\Library' folder). Within this file, I replaced all occurrences of '190' with '230' as well as '210' with '230'. Then I saved the file. Using a regular text editor, I opened the file named 'dclfgx.dproj' (located in my 'C:\Delphi 10 Seattle\Third-Party Tools\FGX 0.7.0.69\Design' folder). Within this file, I replaced all occurrences of '210' with '230'. Then I saved the file. I launched 'Delphi 10 Seattle' and opened the group project named 'FGXGroup.groupproj'. In 'Project Manager', I verified that 'fgx230.bpl' was active in 'Debug' configuration: I right-mouse clicked on 'fgx230.bpl' and selected 'Options...'. Within the 'DCP output directory' box of the 'Delphi Compiler' option, I replaced the '$(BDSLIB)\$(PLATFORM)\$(CONFIG)' entry with 'C:\Delphi 10 Seattle\Third-Party Tools\FGX 0.7.0.69\Library\$(PLATFORM)\$(CONFIG)'. Then I copied this new entry into the 'Package output directory' and the 'Unit output directory' boxes: I did the same as above (#7) for the 'Release' configuration: Back in 'Debug' configuration, I set the 'Build control' of the 'Description' option to 'Rebuild as needed': Then I built and installed 'fgx230.bpl': In 'Project Manager', I activated file 'dclfgx230.bpl' in 'Debug' configuration: I set the content of the 'DCP output directory', 'Package output directory' and 'Unit output directory' boxes of the 'Delphi Compiler' option to 'C:\Delphi 10 Seattle\Third-Party Tools\FGX 0.7.0.69\Library\$(PLATFORM)\$(CONFIG)'. I also set the 'Search path' of the 'Delphi Compiler' option to 'C:\Delphi 10 Seattle\Third-Party Tools\FGX 0.7.0.69\Library': Then I set the 'Build control' of the 'Description' option to 'Rebuild as needed': Finally, I installed 'dclfgx230.bpl'. If everything worked properly, the 'FGX' components should now be part of your IDE.
    1 балл
  3. Я сделал это !!! И это бесплатно! )) Отправка ИОС пушей на русском из делфи больше не секрет!!! Полный исходник, максимально упрощенный. Можно указывать циферку на иконке(badge). Про войну с сертификатом SSL pem писал тут http://fire-monkey.ru/topic/1751-push-soobscheniia-ios-ne-mogu-soedinitsia-s-serverom-dlia-o/ procedure TForm1.Button2Click(Sender: TObject); var i: integer; s,c,t,m: string; vStr: TStringStream; begin m := EscapeString('Удачи друзья в FMX!'); //ready for unicode if not tcpclient.connected then tcpclient.connect; c := 'qwerqwerqwerqwerqwerqwerqwerqwerqwer'; //your token t := ''; for i := 0 to (length© div 2) - 1 do t := t + AnsiChar(Byte(('$'+copy(c,i*2+1,2)).ToInteger)); //token as hex s := '{"aps":{"alert":"'+ m +'","sound":"default","badge":0}}'; //payload s := #0#0#32 + t + #0 + AnsiChar(length(s)) + s; //push message vStr := TStringStream.Create(s); try SSLHandler.write(vStr); finally vStr.Free; end; end function TForm1.EscapeString(const AValue: string): string; const ESCAPE = '\'; REVERSE_SOLIDUS = '\'; SOLIDUS = '/'; BACKSPACE = #8; FORM_FEED = #12; NEW_LINE = #10; CARRIAGE_RETURN = #13; HORIZONTAL_TAB = #9; var AChar: Char; begin Result := ''; for AChar in AValue do begin case AChar of REVERSE_SOLIDUS: Result := Result + ESCAPE + REVERSE_SOLIDUS; SOLIDUS: Result := Result + ESCAPE + SOLIDUS; BACKSPACE: Result := Result + ESCAPE + 'b'; FORM_FEED: Result := Result + ESCAPE + 'f'; NEW_LINE: Result := Result + ESCAPE + 'n'; CARRIAGE_RETURN: Result := Result + ESCAPE + 'r'; HORIZONTAL_TAB: Result := Result + ESCAPE + 't'; else begin if (Integer(AChar) < 32) or (Integer(AChar) > 126) then Result := Result + ESCAPE + 'u' + IntToHex(Integer(AChar), 4) else Result := Result + AChar; end; end; end; end; object TCPClient: TIdTCPClient OnStatus = TCPClientStatus IOHandler = SSLHandler ConnectTimeout = 0 Host = 'gateway.sandbox.push.apple.com' IPVersion = Id_IPv4 Port = 2195 ReadTimeout = -1 Left = 328 Top = 48 end object SSLHandler: TIdSSLIOHandlerSocketOpenSSL OnStatus = SSLHandlerStatus Destination = 'gateway.sandbox.push.apple.com:2195' Host = 'gateway.sandbox.push.apple.com' MaxLineAction = maException Port = 2195 DefaultPort = 0 SSLOptions.CertFile = 'MyAPN.pem' SSLOptions.KeyFile = 'MyAPN.pem' SSLOptions.Method = sslvSSLv23 SSLOptions.SSLVersions = [sslvSSLv2, sslvSSLv3, sslvTLSv1, sslvTLSv1_1, sslvTLSv1_2] SSLOptions.Mode = sslmClient SSLOptions.VerifyMode = [] SSLOptions.VerifyDepth = 0 Left = 328 Top = 108 end
    1 балл
Эта таблица лидеров рассчитана в Москва/GMT+03:00
×
×
  • Создать...