Toggle navigation
Toggle navigation
This project
Loading...
Sign in
iOS
/
asi-http-request
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
Luke Redpath
2010-08-23 19:57:36 +0100
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Committed by
Ben Copsey
2010-08-30 16:27:29 +0100
Commit
80d3f4fcc1fc96c991f1920c57d60698e0020608
80d3f4fc
1 parent
bf907c58
Runtime checks are required for multi-tasking on iOS3 devices
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
2 deletions
Classes/ASIHTTPRequest.m
Classes/ASIHTTPRequest.m
View file @
80d3f4f
...
...
@@ -665,6 +665,15 @@ static NSOperationQueue *sharedQueue = nil;
#pragma mark request logic
BOOL
isMultitaskingSupported
()
{
BOOL
multiTaskingSupported
=
NO
;
if
([[
UIDevice
currentDevice
]
respondsToSelector
:
@selector
(
isMultitaskingSupported
)])
{
multiTaskingSupported
=
[[
UIDevice
currentDevice
]
isMultitaskingSupported
];
}
return
multiTaskingSupported
;
}
// Create the request
-
(
void
)
main
{
...
...
@@ -673,7 +682,7 @@ static NSOperationQueue *sharedQueue = nil;
[[
self
cancelledLock
]
lock
];
#if TARGET_OS_IPHONE && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_4_0
if
(
[[
UIDevice
currentDevice
]
isMultitaskingSupported
]
&&
[
self
shouldContinueWhenAppEntersBackground
])
{
if
(
isMultitaskingSupported
()
&&
[
self
shouldContinueWhenAppEntersBackground
])
{
backgroundTask
=
[[
UIApplication
sharedApplication
]
beginBackgroundTaskWithExpirationHandler
:
^
{
// Synchronize the cleanup call on the main thread in case
// the task actually finishes at around the same time.
...
...
@@ -2966,7 +2975,7 @@ static NSOperationQueue *sharedQueue = nil;
CFRunLoopStop
(
CFRunLoopGetCurrent
());
#if TARGET_OS_IPHONE && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_4_0
if
(
[[
UIDevice
currentDevice
]
isMultitaskingSupported
]
&&
[
self
shouldContinueWhenAppEntersBackground
])
{
if
(
isMultitaskingSupported
()
&&
[
self
shouldContinueWhenAppEntersBackground
])
{
dispatch_async
(
dispatch_get_main_queue
(),
^
{
if
(
backgroundTask
!=
UIBackgroundTaskInvalid
)
{
[[
UIApplication
sharedApplication
]
endBackgroundTask
:
backgroundTask
];
...
...
Please
register
or
login
to post a comment