Igor Delovski Board Forum Index Igor Delovski Board
My Own Personal Slashdot!
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Networking & data transfer

 
Post new topic   Reply to topic    Igor Delovski Board Forum Index -> Mac Cocoa
Mac Cocoa  
Author Message
XNote
Kapetan


Joined: 16 Jun 2006
Posts: 532

PostPosted: Mon Apr 13, 2009 7:37 pm    Post subject: Networking & data transfer Reply with quote

iphonedevsdk.com - How to upload and download from http server?

"I'm having trouble figuring this out, or finding an easy solution. I figured out
the downloading part I think from the apple docs."
Back to top
View user's profile Send private message
delovski



Joined: 14 Jun 2006
Posts: 3524
Location: Zagreb

PostPosted: Fri Apr 17, 2009 12:37 am    Post subject: Reply with quote

Atrexis Blog - iPhone - Establishing an HTTP Connection

"I will be making a request to an image, then displaying the received image
on the screen. After that, I will save the image to the Photo album in the
iPhone."
Back to top
View user's profile Send private message Visit poster's website
Ike
Kapetan


Joined: 17 Jun 2006
Posts: 3146
Location: Europe

PostPosted: Fri Apr 24, 2009 1:10 am    Post subject: Reply with quote

iphonedevsdk.com - Send files over socket connection

"-- want to send files to iphone over socket connection/wifi; so downloaded ASyncSocket which generates plenty of build errors related to Jam deprecated.

... trying to connect to my c++ windows socket software -- which works fine between to windows machines over port 8686.

I got this code from this forum, which so far does nada, but eventually goes to NSStreamEventErrorOccurred in the debugger:

So which port do I use? -- tried 2222; 3258; 60000; and 8686
Make the iphone the client or the server?"
Back to top
View user's profile Send private message
delovski



Joined: 14 Jun 2006
Posts: 3524
Location: Zagreb

PostPosted: Wed May 20, 2009 3:06 pm    Post subject: Reply with quote

iphonedevsdk.com - Retrieving a set of data from my own webserver

"I plan to have a MySQL database on my server, from which I would query
and retrieve several different types of data. Namely, I'd be retrieving data
from CHAR (text), date, and BLOB (image) columns."
Back to top
View user's profile Send private message Visit poster's website
XNote
Kapetan


Joined: 16 Jun 2006
Posts: 532

PostPosted: Fri Jun 05, 2009 6:00 pm    Post subject: Reply with quote

mobileorchard.com - Tutorial: Networking and Bonjour on iPhone

"In this tutorial, we are going to explore a simple chat application for the
iPhone. It allows you to host your own chat room and advertise it on your
local Wi-Fi network (in which case your app acts as a chat “server”) or find
and join chat rooms hosted by other people on your network (acting as a
chat “client”)."
Back to top
View user's profile Send private message
delovski



Joined: 14 Jun 2006
Posts: 3524
Location: Zagreb

PostPosted: Tue Jun 09, 2009 11:38 pm    Post subject: Reply with quote

groups.google.com - iPhone ping command, howto implement? Options

"Im trying to implement unix 'ping' on the iphone
but not sure how to do it? "
Back to top
View user's profile Send private message Visit poster's website
XNote
Kapetan


Joined: 16 Jun 2006
Posts: 532

PostPosted: Sat Jun 27, 2009 4:52 pm    Post subject: Reply with quote

MF - Networking with a lab instrument

"We recently received a new piece of equipment for the lab, which has a net-
work interface. Since I already have myCocoaSoftware for the analysis, why
not try to extend this to include measurements as well."
Back to top
View user's profile Send private message
Ike
Kapetan


Joined: 17 Jun 2006
Posts: 3146
Location: Europe

PostPosted: Thu Jul 09, 2009 5:58 pm    Post subject: Reply with quote

SO - How to integrate NSURLConnection with UIProgressView?

"I'm trying to integrate a NSURLConnection object with UIProgressView, so I
can update the user while a file download is happening in the background."
Back to top
View user's profile Send private message
delovski



Joined: 14 Jun 2006
Posts: 3524
Location: Zagreb

PostPosted: Wed Jul 22, 2009 2:00 am    Post subject: Reply with quote

Brian Hall - Beej's Guide to Network Programming

"Hey! Socket programming got you down? Is this stuff just a little too
difficult to figure out from the man pages? You want to do cool Internet
programming, but you don't have time to wade through a gob of structs
trying to figure out if you have to call bind() before you connect(), etc.,
etc.

Well, guess what! I've already done this nasty business, and I'm dying to
share the information with everyone! You've come to the right place. This
document should give the average competent C programmer the edge
s/he needs to get a grip on this networking noise.

And check it out: I've finally caught up with the future (just in the nick of
time, too!) and have updated the Guide for IPv6! Enjoy!"
Back to top
View user's profile Send private message Visit poster's website
delovski



Joined: 14 Jun 2006
Posts: 3524
Location: Zagreb

PostPosted: Wed Aug 05, 2009 2:50 pm    Post subject: Reply with quote

MF - Progress bar while upload file - Code which I am using for file
upload


"NSURLConnection sendSynchronousRequest: blocks the current thread until
it completes. Either run this is a separate thread and update the UI on the
main thread or use the asychronous methods of NSURLConnection as clearly
described in the documentation."
Back to top
View user's profile Send private message Visit poster's website
Ike
Kapetan


Joined: 17 Jun 2006
Posts: 3146
Location: Europe

PostPosted: Sat Aug 15, 2009 8:58 pm    Post subject: Reply with quote

How to Make Your iPhone App Send Email with Attachments,
by MATTJDRAKE, How to Make iPhone Apps

"In iPhone OS 3.0 you can easily send pictures and voice recordings from
your app in an email. In fact, now your emails can be easily formated using
HTML and once the user has finished the email control returns back to your
app. Pretty nifty!"
Back to top
View user's profile Send private message
Ike
Kapetan


Joined: 17 Jun 2006
Posts: 3146
Location: Europe

PostPosted: Thu Aug 20, 2009 8:46 pm    Post subject: Reply with quote

iphonedevsdk.com - Cannot HTTP POST to Server, returns empty $_POST

"You should probably implement the NSURLConnectionDelegate didFailWith-
Error method. Also, dont show your alert in didRecieveData. The data may
not all be downloaded. Instead, create an NSMutableData object and append
data in didRecieveData. Then in your didFinishLoading delegate, you can
show the alert with the full contents of the data."
Back to top
View user's profile Send private message
delovski



Joined: 14 Jun 2006
Posts: 3524
Location: Zagreb

PostPosted: Sun Aug 30, 2009 11:34 pm    Post subject: Reply with quote

praveenmatanam.wordpress.com - Avoiding WiFi disconnections

* UIRequiresPersistentWiFi *

"Any iPhone application that requires a WiFi connection must set UIRequires-
PersistentWiFi to <true/>, otherwise the iPhone will abruptly disconnect the
WiFi connection after 30 minutes of use."
Back to top
View user's profile Send private message Visit poster's website
delovski



Joined: 14 Jun 2006
Posts: 3524
Location: Zagreb

PostPosted: Sun Aug 30, 2009 11:43 pm    Post subject: Reply with quote

davidjhinson.wordpress.com - iPhone Email Attachments – Revisited

"Gmail simply will not let you see embedded images. Period."

Objective-C and HTTP Basic Authentication

"Base64 encoding is used to convert binary data into text that can be trans-
mitted using HTTP (like, say, for embedding images in email) or for some-
what obfuscating user ids and passwords to be sent “in the clear” over HTTP
(like for Basic Authentication). ... And here is how one may transmit a user
id and password (using NSURLConnection) to establish a connection using
Basic Authentication"
Back to top
View user's profile Send private message Visit poster's website
Ike
Kapetan


Joined: 17 Jun 2006
Posts: 3146
Location: Europe

PostPosted: Tue Sep 15, 2009 3:50 pm    Post subject: Reply with quote

SO - How to use bluetooth to connect two iPhone?

"I want to use iPhone SDK to implement a bluetooth connection between two
iPhones, but I don't find any bluetooth API in iPhone SDK 3.0."
Back to top
View user's profile Send private message
delovski



Joined: 14 Jun 2006
Posts: 3524
Location: Zagreb

PostPosted: Sun Sep 20, 2009 2:39 am    Post subject: Reply with quote

iphonedevsdk.com - MFMailComposeViewController: image attachment

"The image is correctly displayed when I send the email, but when I receive
it the image cannot be displayed because it contains some errors."
Back to top
View user's profile Send private message Visit poster's website
delovski



Joined: 14 Jun 2006
Posts: 3524
Location: Zagreb

PostPosted: Sat Oct 03, 2009 1:45 am    Post subject: Reply with quote

adc - CFNetServiceCreate() - CFNetServices Reference

Code:
CFNetServiceRef CFNetServiceCreate (
   CFAllocatorRef alloc,
   CFStringRef    domain,
   CFStringRef    serviceType,
   CFStringRef    name,
   SInt32         port
);


"If the CFNetService is to run in asynchronous mode, call CFNetService-
SetClient to prepare the service for running in asynchronous mode. Then
call CFNetServiceScheduleWithRunLoop to schedule the service on a run
loop. Then call CFNetServiceRegister to make the service available."


Last edited by delovski on Sat Oct 03, 2009 2:22 am; edited 1 time in total
Back to top
View user's profile Send private message Visit poster's website
delovski



Joined: 14 Jun 2006
Posts: 3524
Location: Zagreb

PostPosted: Sat Oct 03, 2009 2:22 am    Post subject: Reply with quote

adc - CFSocketSetAddress() - CFSocket Reference

Code:
CFSocketError CFSocketSetAddress (
   CFSocketRef s,
   CFDataRef   address
);


"Binds a local address to a CFSocket object."
Back to top
View user's profile Send private message Visit poster's website
delovski



Joined: 14 Jun 2006
Posts: 3524
Location: Zagreb

PostPosted: Sat Oct 03, 2009 2:27 am    Post subject: Reply with quote

adc - CFSocketCopyAddress() - CFSocket Reference

Code:
CFDataRef CFSocketCopyAddress (
   CFSocketRef s
);


"The local address, stored as a struct sockaddr in a CFData object, of s."
Back to top
View user's profile Send private message Visit poster's website
delovski



Joined: 14 Jun 2006
Posts: 3524
Location: Zagreb

PostPosted: Sat Oct 03, 2009 3:06 am    Post subject: Reply with quote

iphonedevsdk.com - CFNetwork Memory Leak

"There is a 3.5k leak that's been reported quite a bit related to networking.
Is that what you're seeing? It's an OS bug. There's no workaround."
Back to top
View user's profile Send private message Visit poster's website
delovski



Joined: 14 Jun 2006
Posts: 3524
Location: Zagreb

PostPosted: Thu Jan 21, 2010 1:05 am    Post subject: Reply with quote

MF - How to code a network application

"Basically what im trying to do is have the iPhone act as a 'client' and
connect to a OSX application 'server'."
Back to top
View user's profile Send private message Visit poster's website
delovski



Joined: 14 Jun 2006
Posts: 3524
Location: Zagreb

PostPosted: Fri Jan 22, 2010 9:08 am    Post subject: Reply with quote

MF - Bonjour, NSStream and Multicast

"I need to send the same data to a whole heap of iPhones at once (potenti-
ally thousands) from a single Mac. These iPhones are all on the same wire-
less network."
Back to top
View user's profile Send private message Visit poster's website
Ike
Kapetan


Joined: 17 Jun 2006
Posts: 3146
Location: Europe

PostPosted: Wed Feb 17, 2010 9:03 pm    Post subject: Reply with quote

MF - Gamekit API

"I know I can't connect because of limitations of the iPhone simulator, but
what I do know is that the simulator detects available peers and you can
see the name in the GKPeerPickerViewController interface."
Back to top
View user's profile Send private message
delovski



Joined: 14 Jun 2006
Posts: 3524
Location: Zagreb

PostPosted: Sun Mar 21, 2010 11:11 pm    Post subject: Reply with quote

SO - BSD Sockets don’t behave in a iPhone 3G environment

"The CFStream Socket Additions are what Apple recommends you use
instead of the direct BSD sockets."
Back to top
View user's profile Send private message Visit poster's website
delovski



Joined: 14 Jun 2006
Posts: 3524
Location: Zagreb

PostPosted: Sun Mar 28, 2010 9:09 pm    Post subject: Reply with quote

MF - Simple Network Code

"Use AsyncSocket: http://code.google.com/p/cocoaasyncsocket/

It's pretty easy to work with, if you have some Cocoa skills. The first time
I used it, I was very new to Cocoa and Objective-C, but quite experienced
with Java and other programming languages. I had it interoperating with
Java networking apps in only a few days worth of playing with it."
Back to top
View user's profile Send private message Visit poster's website
delovski



Joined: 14 Jun 2006
Posts: 3524
Location: Zagreb

PostPosted: Mon Apr 19, 2010 12:17 am    Post subject: Reply with quote

zachwaugh - Programmatically Retrieving IP Address of iPhone

"There are some undocumented methods that work ([NSHost addresses]),
but I didn’t want to risk them pulling that out of there and my app breaking.
So I wrote some C code (cobbled together from various sources) that will
loop through the network interfaces and retrieve the IP address."
Back to top
View user's profile Send private message Visit poster's website
delovski



Joined: 14 Jun 2006
Posts: 3524
Location: Zagreb

PostPosted: Wed May 05, 2010 4:57 pm    Post subject: Reply with quote

Jeff LaMarche - NSStream: TCP and SSL

"The way that we enable SSL encryption is to simply use setProperty:forKey:
on both streams, setting the key NSStreamSocketSecurityLevelKey to a
value that specifies the version of SSL to use. If you want to tell NSStream
to use the highest version supported in common with the remote connection,
specify NSStreamSocketSecurityLevelKey. That's what you'll usually want."
Back to top
View user's profile Send private message Visit poster's website
delovski



Joined: 14 Jun 2006
Posts: 3524
Location: Zagreb

PostPosted: Mon May 24, 2010 6:23 pm    Post subject: Reply with quote

so - iPhone SDK: Storing username and password in the code

"If this is FTP, then you are sending the credentials over the network unen-
crypted. If you expect to protect these credentials, you've already lost,
because anyone with any interest can easily sniff the password off of the
wireless network."
Back to top
View user's profile Send private message Visit poster's website
delovski



Joined: 14 Jun 2006
Posts: 3524
Location: Zagreb

PostPosted: Mon May 24, 2010 11:31 pm    Post subject: Reply with quote

Jeff LaMarche - Downloading Images for a Table without Threads

"I've written a small iPhone app that downloads images from Deviant Art.
You just enter somebody's Deviant Art username into a text field and the
application will grab the the images in that person's gallery, download them
asynchronously, and display each one in the table once it's finished down-
loading."


Nice comments: Neil Mix, Chris Gummer, plus more by Jeff:

"Have you actually gotten the application to crash by hitting the back but-
ton? I haven't. I think your reasoning misses an important point: NSURL-
Connection is one of the few classes that actually retains its delegate. As
long as the request is active, the delegate won't go anywhere.

The documentation does not make this point obvious, but it is easy to con-
firm by checking the retain count in the debugger."


Last edited by delovski on Thu Aug 05, 2010 10:35 pm; edited 3 times in total
Back to top
View user's profile Send private message Visit poster's website
Ike
Kapetan


Joined: 17 Jun 2006
Posts: 3146
Location: Europe

PostPosted: Mon Jun 28, 2010 1:27 pm    Post subject: Reply with quote

MF - Using POST method to get the cookies(by clicking button)

"And then the user has to click a button to submit the data through the
url POST method and then the cookies of the website will be return to
the application. There are some http 302 (redirect) or 303 in some of
the website."
Back to top
View user's profile Send private message
delovski



Joined: 14 Jun 2006
Posts: 3524
Location: Zagreb

PostPosted: Thu Jul 29, 2010 11:55 pm    Post subject: Reply with quote

so - iPhone : upload image to web aspx file

"I have a little problem. I have to upload a photo from my iPhone to a web
server with POST Method but the server file is in aspx. I tried my code with
my server and PHP file : works well ! Now with aspx file : doesn't upload..."
Back to top
View user's profile Send private message Visit poster's website
delovski



Joined: 14 Jun 2006
Posts: 3524
Location: Zagreb

PostPosted: Sat Jul 31, 2010 12:07 am    Post subject: Reply with quote

iphonedevsdk.com - Sending JSON to a URL

"So, for instance if my remote database is called 'SportsData', located at
http://www.website.com, with tables 'event' and 'user' and I want to send
it the following query."
Back to top
View user's profile Send private message Visit poster's website
delovski



Joined: 14 Jun 2006
Posts: 3524
Location: Zagreb

PostPosted: Thu Aug 05, 2010 9:36 pm    Post subject: Reply with quote

so - Handling redirects correctly with NSURLConnection

"The idea here is that instead of cloning the new request and trying to shape
it the same as the one Cocoa Touch sends me, I create a clone of the origi-
nal request and change just the URL to match the request Cocoa Touch sent
me."
Back to top
View user's profile Send private message Visit poster's website
XNote
Kapetan


Joined: 16 Jun 2006
Posts: 532

PostPosted: Tue Aug 24, 2010 5:44 pm    Post subject: Reply with quote

http://stackoverflow.com/questions/3554180/nsurlconnection-connectiondidfinishloading-called-before-all-file-is-downloaded
Back to top
View user's profile Send private message
Ike
Kapetan


Joined: 17 Jun 2006
Posts: 3146
Location: Europe

PostPosted: Mon Sep 20, 2010 3:47 pm    Post subject: Reply with quote

mf - How to connect mysql remote database from iphone

"Here's a blog post where someone has listed the steps to build libmysql
for iPhone. It should be exactly what you need.
...
If you want to save yourself the trouble of having to compile the static lib-
rary yourself, I have a 6 way fat version as part of my MysqlConnector for
Objective-C. You can find more details on my blog."
Back to top
View user's profile Send private message
delovski



Joined: 14 Jun 2006
Posts: 3524
Location: Zagreb

PostPosted: Tue Sep 21, 2010 1:25 am    Post subject: Reply with quote

blog.objectgraph.com - Encrypting / Decrypting / Base64 Encode /
Decode in iPhone Objective-C


"I went through websites to find good tricks to send encrypted data to
my server. Here is encryption / decryption functions by Jeff and Base64
functions by Cyrus"
Back to top
View user's profile Send private message Visit poster's website
XNote
Kapetan


Joined: 16 Jun 2006
Posts: 532

PostPosted: Sat Oct 23, 2010 3:56 am    Post subject: Reply with quote

iphonedevsdk.com - Gamekit API

"I want to connect several iPhones using Gamekit via Bluetooth... I don´t
want to use GKPeerPickerController..."
Back to top
View user's profile Send private message
delovski



Joined: 14 Jun 2006
Posts: 3524
Location: Zagreb

PostPosted: Mon Nov 01, 2010 11:41 am    Post subject: Reply with quote

http://efreedom.com/Question/1-2048439/iPhone-Sockets-3g-Vs-Wifi
Back to top
View user's profile Send private message Visit poster's website
delovski



Joined: 14 Jun 2006
Posts: 3524
Location: Zagreb

PostPosted: Fri Nov 12, 2010 11:53 pm    Post subject: Reply with quote

so - iPhone: Catching a Connection Error With NSStream

"I have written a program that connects to a server on a given IP using the
NSStream protocol outlined in Apple's stream programming guide. The con-
nection and transfer of data works flawlessly, however if the user specifies
the wrong IP and the program attempts to open the streams it results in the
program becoming unresponsive."
Back to top
View user's profile Send private message Visit poster's website
Ike
Kapetan


Joined: 17 Jun 2006
Posts: 3146
Location: Europe

PostPosted: Sat Apr 09, 2011 10:01 pm    Post subject: Reply with quote

MF - Socket connection problem C

"Pretty simple. You are on your LAN, not the Internet. Use your local IP and
it will work fine. If you are connected to the Internet from somewhere out-
side your LAN, use your router's public IP address.

If you try to connect to your routers public IP address from inside, it won't
route back. Some routers can be configured to do that, but most can't."
Back to top
View user's profile Send private message
delovski



Joined: 14 Jun 2006
Posts: 3524
Location: Zagreb

PostPosted: Fri May 13, 2011 8:24 pm    Post subject: Reply with quote

so - Download multiple files using SimpleFTPSample

"I've been trying to figure out how to download multiple files in a row based
on the SimpleFTPSample provided by apple. Basically, I'm filtering what the
user can see when they browse an ftp server, but when they select a certain
file type, I want it to automatically check for another file of the same name
with a different extension and if it exists, download it as well."
Back to top
View user's profile Send private message Visit poster's website
Ike
Kapetan


Joined: 17 Jun 2006
Posts: 3146
Location: Europe

PostPosted: Sat Aug 20, 2011 11:35 pm    Post subject: Reply with quote

JLM - Online Session Code for Big Objects (Plus a Warning)

"In Chapter 9 of More iPhone Development, we wrote a set of classes that
mimicked the behavior of GameKit's peer-to-peer connectivity... A while
back, I faced exactly that situation. For a kiosk app that MartianCraft was
writing for a client, I needed to send large images shot with a DSLR camera
from a Mac Cocoa program to an iPad program and also needed to send
pictures taken with the iPad's camera back to the Mac Cocoa app. These
images, compressed, ranged from about one to about five megs. I grabbed
the OnlineSession class from More, figuring I had the network code basically
done, and watched my application go down in a blaze of… well… not glory,
that's for sure."
Back to top
View user's profile Send private message
Ike
Kapetan


Joined: 17 Jun 2006
Posts: 3146
Location: Europe

PostPosted: Mon Apr 29, 2013 6:04 pm    Post subject: Reply with quote

reddit - Simulate Mobile Network Latency, Delay, and Packet Loss in OS X and iOS Simulator

"I've had good success with [1] Speed Limit. Or you can try [2] Slowy or even do it yourself:

Create a pipe "1" limited to 500KBytes/s via
sudo ipfw pipe 1 config bw 500KByte/s
Guide all network traffic of port 80 through pipe "1" using
sudo ipfw add 1 pipe 1 src-port 80
When you don't need the pipe anymore, remove it from the port using
sudo ipfw delete 1"
Back to top
View user's profile Send private message
delovski



Joined: 14 Jun 2006
Posts: 3524
Location: Zagreb

PostPosted: Thu Nov 10, 2016 4:21 pm    Post subject: Reply with quote

so - How to handle 'CFNetwork SSLHandshake failed' in iOS

"Some times i'm getting CFNetwork SSLHandshake failed -(9806) in my
code,but i'm not sure why this is happening as my code runs smoothly,except
when i run it in iOS 6 and then on iOS 7 64-bit i get this warning."
Back to top
View user's profile Send private message Visit poster's website
delovski



Joined: 14 Jun 2006
Posts: 3524
Location: Zagreb

PostPosted: Mon Aug 28, 2017 5:10 pm    Post subject: Reply with quote

git - Official Objective-C SDK for the Dropbox API v2

"The Official Dropbox Objective-C SDK for integrating with Dropbox API v2
on iOS or macOS."


git - Dropbox: Migrating from API v1

"If your app was originally using an earlier API v1 SDK, including the iOS
Core SDK, the OS X Core SDK, the iOS Sync SDK, or the OS X Sync SDK,
then you can use the v2 SDK to perform a one-time migration of OAuth 1
tokens to OAuth 2.0 tokens, which are used by API v2. That way, when you
migrate your app from the earlier SDK to the new API v2 SDK, users will not
need to reauthenticate with Dropbox after you perform this update."


db - API v1 -> v2 Migration guide

"Migration checklist for developers:

* Check whether you need to migrate your user's access tokens or re-
authenticate with a new permission.
* Familiarize yourself with the new v2 syntax. Read up on the patterns of
v2 endpoints, do a tutorial for an SDK, and test-drive v2 calls with your
own data in the API Explorer.
* Figure out which v1 endpoints your app uses, and look up the equivalent
ones in API v2 using our v1 → v2 mapping table.
* Update your app's code, replacing API v1 calls with API v2 calls.
* If there's functionality missing in v2, update what you can, and support
the rest with a hybrid integration. Also, please file a support ticket with us
about the missing functionality, so we can keep track of feature requests.
* Update the error handling in your app to utilize v2 errors."
Back to top
View user's profile Send private message Visit poster's website
Ike
Kapetan


Joined: 17 Jun 2006
Posts: 3146
Location: Europe

PostPosted: Wed Oct 11, 2017 8:25 pm    Post subject: Reply with quote

github.com - trezor-crypto/base58.c

Heavily optimized cryptography algorithms for embedded devices.
Back to top
View user's profile Send private message
delovski



Joined: 14 Jun 2006
Posts: 3524
Location: Zagreb

PostPosted: Mon Dec 04, 2017 8:10 pm    Post subject: Reply with quote

apple - Using NSURLSession

"The NSURLSession class and related classes provide an API for downloading
content via HTTP. This API provides a rich set of delegate methods for sup-
porting authentication and gives your app the ability to perform background
downloads when your app is not running or, in iOS, while your app is
suspended."
Back to top
View user's profile Send private message Visit poster's website
delovski



Joined: 14 Jun 2006
Posts: 3524
Location: Zagreb

PostPosted: Tue Dec 19, 2017 3:40 pm    Post subject: Reply with quote

AWSURLSessionManager.m

Code:
- (void)URLSession:(NSURLSession *)session dataTask:(NSURLSessionDataTask *)dataTask didReceiveData:(NSData *)data {
    AWSURLSessionManagerDelegate *delegate = [self.sessionManagerDelegates objectForKey:@(dataTask.taskIdentifier)];
   
    if (delegate.responseFilehandle) {
        [delegate.responseFilehandle writeData:data];
    } else {
        if (!delegate.responseData) {
            delegate.responseData = [NSMutableData dataWithData:data];
        } else if ([delegate.responseData isKindOfClass:[NSMutableData class]]) {
            [delegate.responseData appendData:data];
        }
    }

    AWSNetworkingDownloadProgressBlock downloadProgress = delegate.request.downloadProgress;
    if (downloadProgress) {

        int64_t bytesWritten = [data length];
        delegate.payloadTotalBytesWritten += bytesWritten;
        int64_t byteRangeStartPosition = 0;
        int64_t totalBytesExpectedToWrite = dataTask.response.expectedContentLength;
        if ([dataTask.response isKindOfClass:[NSHTTPURLResponse class]]) {
            NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *)dataTask.response;
            NSString *contentRangeString = [[httpResponse allHeaderFields] objectForKey:@"Content-Range"];
            int64_t trueContentLength = [[[contentRangeString componentsSeparatedByString:@"/"] lastObject] longLongValue];
            if (trueContentLength) {
                byteRangeStartPosition = trueContentLength - dataTask.response.expectedContentLength;
                totalBytesExpectedToWrite = trueContentLength;
            }
        }
        downloadProgress(bytesWritten,delegate.payloadTotalBytesWritten + byteRangeStartPosition,totalBytesExpectedToWrite);
    }
   
}
Back to top
View user's profile Send private message Visit poster's website
delovski



Joined: 14 Jun 2006
Posts: 3524
Location: Zagreb

PostPosted: Tue Dec 19, 2017 3:41 pm    Post subject: Reply with quote

books.google.hr - iOS 7 Programming Pushing the Limits
Back to top
View user's profile Send private message Visit poster's website
delovski



Joined: 14 Jun 2006
Posts: 3524
Location: Zagreb

PostPosted: Fri Feb 23, 2018 10:56 pm    Post subject: Reply with quote

so - How can I add NSAppTransportSecurity to my info.plist file?

"Also one more option, if you want to disable ATS you can use this :

<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key><true/>
</dict>

But this is not recommended at all. The server should have the SSL certificates
and so that there is no privacy leaks."
Back to top
View user's profile Send private message Visit poster's website
delovski



Joined: 14 Jun 2006
Posts: 3524
Location: Zagreb

PostPosted: Sat Feb 24, 2018 3:20 pm    Post subject: Reply with quote

ad - Tune NSURLSessionUploadTask retry for NSBackgroundURLSession (watchOS) to limit number of requests.

"NSBackgroundURLSession (watchOS) executes my ~2mb upload multiple
(sometimes >100) times before the task is returned to my app as completed."
Back to top
View user's profile Send private message Visit poster's website
delovski



Joined: 14 Jun 2006
Posts: 3524
Location: Zagreb

PostPosted: Sat Feb 24, 2018 3:25 pm    Post subject: Reply with quote

so - NSURLSession with WatchOS 2.2 very slow

"But I find immediate improvement by using the iOS app to make the
network request and send it to the watch app.

I use WCSession sendMessage:replyHandler:errorHandler in watchOS to notify
the iOS app to make a specific network request.

Then I send back the response from the network request via the replyHandler
in session:didReceiveMessage:replyHandler. There's only a short lag.

As a fallback, whenever sendMessage fails, I make the same request via the
watch app, so it should still work if iPhone is not nearby."
Back to top
View user's profile Send private message Visit poster's website
delovski



Joined: 14 Jun 2006
Posts: 3524
Location: Zagreb

PostPosted: Mon Sep 24, 2018 2:09 pm    Post subject: Reply with quote

scaledrone - iOS Chat Tutorial: Building A Realtime Messaging App

"One thing that can differentiate your app from other apps on the market
is building in chat functionality. Online marketplaces, social networks and
collaboration tools can all benefit from in-app chat. Your users can com-
municate with each other without having to exchange contact information
or leave the app."
Back to top
View user's profile Send private message Visit poster's website
delovski



Joined: 14 Jun 2006
Posts: 3524
Location: Zagreb

PostPosted: Wed Oct 31, 2018 5:43 pm    Post subject: Reply with quote

a - Downloading Files in the Background

"For long-running and nonurgent transfers, you can create tasks that run in the
background. These tasks continue to run even when your app is suspended,
allowing your app to access the downloaded file when the app is resumed."
Back to top
View user's profile Send private message Visit poster's website
delovski



Joined: 14 Jun 2006
Posts: 3524
Location: Zagreb

PostPosted: Fri Nov 02, 2018 2:57 pm    Post subject: Reply with quote

apple - Core NFC

"Your app can read tags to give users more information about their physical
environment and the real-world objects in it. Using Core NFC, you can read
Near Field Communication (NFC) tags of types 1 through 5 that contain data
in the NFC Data Exchange Format (NDEF). For example, your app might give
users information about products they find in a store or exhibits they visit in
a museum."


Apple adds support for contactless student ID cards in Wallet
Back to top
View user's profile Send private message Visit poster's website
Ike
Kapetan


Joined: 17 Jun 2006
Posts: 3146
Location: Europe

PostPosted: Thu Mar 28, 2019 11:00 pm    Post subject: Reply with quote

https://old.reddit.com/r/iOSProgramming/comments/b6lij5/its_time_to_break_up_with_your_networking_library/

ArticleIt's time to break up with your networking library for URLSession
Back to top
View user's profile Send private message
Ike
Kapetan


Joined: 17 Jun 2006
Posts: 3146
Location: Europe

PostPosted: Thu Aug 27, 2020 6:43 pm    Post subject: Reply with quote

git - OHMySQL

"The library supports Objective-C and Swift, iOS and macOS. You can connect to
your remote MySQL database using OHMySQL API. It allows you doing queries
in easy and object-oriented way. Common queries such as SELECT, INSERT,
DELETE, JOIN are wrapped by Objective-C code and you don't need to dive into
MySQL C API."
Back to top
View user's profile Send private message
Ike
Kapetan


Joined: 17 Jun 2006
Posts: 3146
Location: Europe

PostPosted: Wed Mar 31, 2021 8:07 pm    Post subject: Reply with quote

rw - Implementing OAuth with ASWebAuthenticationSession

"... you'll create a third-party GitHub app that you can authenticate via the
OAuth standard using ASWebAuthenticationSession and display a list of
repositories owned by the user. In the process, you'll learn about:

OAuth
Session tokens
Ephemeral sessions"
Back to top
View user's profile Send private message
Ike
Kapetan


Joined: 17 Jun 2006
Posts: 3146
Location: Europe

PostPosted: Wed Jan 24, 2024 9:13 am    Post subject: Reply with quote

so - nw_read_request_report [C9] Receive failed with error "Software caused connection abort"

"I also ran into this issue, maybe this could give you an insight?

https://forums.developer.apple.com/thread/106838

From one of the replies

> Following up, we determined that the issue was caused because our app
continued to issue new NSURLConnection requests after going into the
background and wasn't explicitly making them background tasks. As we
didn't need background syncing, putting in code to prevent new requests
from going out once the app was in the background eliminated this error."
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Igor Delovski Board Forum Index -> Mac Cocoa All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Delovski.hr
Powered by php-B.B. © 2001, 2005 php-B.B. Group