Recent

Author Topic: ns_url_request erroring on m1 target as Arch64  (Read 1623 times)

Josh

  • Hero Member
  • *****
  • Posts: 1274
ns_url_request erroring on m1 target as Arch64
« on: April 03, 2021, 06:52:33 pm »
Hi

trying out my m1, and getting issue here, looking at it when arch64 I target, ns_url_request thinks its an iPhone

Code: [Select]
unit ns_url_request;

{
  TNSHTTPSendAndReceive class for use by itself as an HTTP client or with
   Web Service Toolkit (http://wiki.freepascal.org/Web_Service_Toolkit).
  Author:    Phil Hess.
  Copyright: Copyright 2011 Phil Hess.
  License:   Modified LGPL (see Free Pascal's rtl/COPYING.FPC).
             This means you can link your code to this compiled unit (statically
             in a standalone executable or dynamically in a library) without
             releasing your code. Only changes to this unit need to be made
             publicly available.
}

{$modeswitch ObjectiveC1}

interface

uses
  SysUtils,
  Classes,
  httpdefs,
{$IF DEFINED(IPHONESIM) OR DEFINED(CPUARM) OR DEFINED(CPUAARCH64)}  //iOS
 {$IFDEF NoiPhoneAll}
  Foundation,
 {$ELSE}
  iPhoneAll,
 {$ENDIF}
{$ELSE}  //macOS
 {$IFDEF NoCocoaAll}
  Foundation,       <--------
 {$ELSE}
  CocoaAll,
 {$ENDIF}
{$ENDIF}
  NSHelpers;           
The best way to get accurate information on the forum is to post something wrong and wait for corrections.

Jonas Maebe

  • Hero Member
  • *****
  • Posts: 1059
Re: ns_url_request erroring on m1 target as Arch64
« Reply #1 on: April 03, 2021, 08:07:07 pm »
You can replace
Code: [Select]
{$IF DEFINED(IPHONESIM) OR DEFINED(CPUARM) OR DEFINED(CPUAARCH64)}
with
Code: [Select]
{$IF DEFINED(IPHONESIM) OR DEFINED(IOS)}

trev

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2023
  • Former Delphi 1-7, 10.2 user
Re: ns_url_request erroring on m1 target as Arch64
« Reply #2 on: April 04, 2021, 12:59:12 am »
Also see the Wiki's Mac Portal in particular these pages:

* macOS NSURLConnection
* macOS NSURLSession

Josh

  • Hero Member
  • *****
  • Posts: 1274
Re: ns_url_request erroring on m1 target as Arch64
« Reply #3 on: April 04, 2021, 12:30:47 pm »
Hi

Jonas Maebe adjusting as suggested solved the issue, Thanks.
Code: Pascal  [Select][+][-]
  1. {$IF DEFINED(IPHONESIM) OR DEFINED(IOS)}

trev Thanks for posting the links, I visit there often, and it holds a mountain of good information.
The best way to get accurate information on the forum is to post something wrong and wait for corrections.

 

TinyPortal © 2005-2018