BKSProcessAssertion: Difference between revisions

From iPhone Development Wiki
(→‎Methods: iOS 9, 10.)
No edit summary
Line 1: Line 1:
''This article is a stub; please help expand it.''
The NSAutoreleasePool class is a thin wrapper around the '''NSPushAutoreleasePool''' and '''NSPopAutoreleasePool''' functions.


'''BKSProcessAssertion''' is a class introduced in iOS 6, implemented in [[BackBoardServices.framework]] (before iOS 8) or [[AssertionServices.framework]] (iOS 8). As described [http://blog.adambell.ca/post/73338421921/breaking-chat-heads-out-of-the-ios-sandbox by Adam Bell], "This class allows you to give a certain application permissions to stay alive and not be killed by watchdog."
<source lang="objc">
#ifdef __cplusplus
extern "C" {
#endif
void *NSPushAutoreleasePool(NSUInteger capacity);
void NSPopAutoreleasePool(void* token);
#ifdef __cplusplus
}
#endif
</source>


== Methods ==
Example:


{{function signature
<source lang="objc">
|signature=+([[NSString]]*)NameForReason:([[NSUInteger]])reason;
static void MyMethod()
|firmware=6.0–
{
}}
    void *pool = NSPushAutoreleasePool(0);
    [[[NSObject alloc] init] autorelease];
    NSPopAutoreleasePool(pool);
}
</source>


{| class="wikitable"
The "capacity" argument of NSPushAutoreleasePool only serves as a hint. It is unused in the current implementation.
|-
! rowspan="2" | Reason
! rowspan="2" | Result
! colspan="5" | Availability
|-
! iOS 6.x
! iOS 7.x
! iOS 8.x
! iOS 9.x
! iOS 10.x
|-
| 0
| @"none"
| colspan="5" {{yes}}
|-
| 1
| @"audio"
| colspan="5" {{yes}}
|-
| 2
| @"location"
| colspan="5" {{yes}}
|-
| 3
| @"external-accessory"
| colspan="5" {{yes}}
|-
| 4
| @"finishTask"
| colspan="5" {{yes}}
|-
| 5
| @"bluetooth"
| colspan="5" {{yes}}
|-
| 6
| @"networkAuthentication"
| colspan="5" {{yes}}
|-
| 7
| @"backgroundUI"
| colspan="5" {{yes}}
|-
| 8
| @"interAppAudioStreaming"
| colspan="5" {{yes}}
|-
| 9
| @"viewServices"
| colspan="5" {{yes}}
|-
| 10
| @"newsstandDownload"
| colspan="5" {{yes}}
|-
| 11
| @"backgroundDownload"
| colspan="5" {{yes}}
|-
| 12
| @"voIP"
| colspan="2" {{no}}
| colspan="3" {{yes}}
|-
| 13
| @"extension"
| colspan="2" {{no}}
| colspan="3" {{yes}}
|-
| 14
| @"continuityStreams"
| colspan="2" {{no}}
| colspan="3" {{yes}}
|-
| 15
| @"HealthKit"
| colspan="2" {{no}}
| ?
| colspan="2" {{yes}}
|-
| 16
| @"WatchConnectivity"
| colspan="2" {{no}}
| ?
| colspan="2" {{yes}}
|-
| 17
| @"snapshot"
| colspan="2" {{no}}
| ?
| colspan="2" {{yes}}
|-
| 18
| @"complicationUpdate"
| colspan="2" {{no}}
| ?
| colspan="2" {{yes}}
|-
| 19
| @"workoutProcessing"
| colspan="4" {{no}}
| {{yes}}
|-
| 20
| @"complicationPushUpdate"
| colspan="4" {{no}}
| {{yes}}
|-
| Other (21-9999)
| @"Unknown"
| colspan="5" {{yes}}
|-
| 10000
| @"activation"
| colspan="5" {{yes}}
|-
| 10001
| @"suspend"
| colspan="5" {{yes}}
|-
| 10002
| @"transientWakeup"
| colspan="5" {{yes}}
|-
| rowspan="2" | 10003
| @"voip"
| colspan="2" {{yes}}
| colspan="3" {{no}}
|-
| @"periodicTask"
| colspan="2" {{no}}
| colspan="3" {{yes}}
|-
| 10004
| @"finishTaskUnbounded"
| colspan="5" {{yes}}
|-
| 10005
| @"continuous"
| colspan="5" {{yes}}
|-
| 10006
| @"backgroundContentFetching"
| colspan="5" {{yes}}
|-
| 10007
| @"notificationAction"
| colspan="2" {{no}}
| colspan="3" {{yes}}
|-
| 10008
| @"PIP"
| colspan="3" {{no}}
| colspan="2" {{yes}}
|-
| Other (10009-49999)
| @"Unknown"
| colspan="5" {{yes}}
|-
| 50000
| @"finishTaskAfterBackgroundContentFetching"
| {{no}}
| colspan="4" {{yes}}
|-
| 50001
| @"finishTaskAfterBackgroundDownload"
| {{no}}
| colspan="4" {{yes}}
|-
| 50002
| @"finishTaskAfterPeriodicTask"
| {{no}}
| colspan="4" {{yes}}
|-
| 50003
| @"finishTaskAfterNotificationAction"
| colspan="2" {{no}}
| colspan="3" {{yes}}
|-
| 50004
| @"finishTaskAfterWatchConnectivity"
| colspan="3" {{no}}
| colspan="2" {{yes}}
|-
| Other (50005+)
| @"Unknown"
| colspan="5" {{yes}}
|}


== External links ==
{{occlass|library=Foundation.framework}}
 
* [http://blog.adambell.ca/post/73338421921/breaking-chat-heads-out-of-the-ios-sandbox Breaking Chat Heads out of the iOS Sandbox] by Adam Bell
* [https://github.com/mattlawer/iOS6-Private-Frameworks/blob/master/BackBoardServices/BKSProcessAssertion.h Header (before iOS 8)].
* [https://github.com/nst/iOS-Runtime-Headers/blob/master/PrivateFrameworks/AssertionServices.framework/BKSProcessAssertion.h Header (iOS 8)].
 
{{occlass|library=BackBoardServices.framework|navbox=on}}

Revision as of 09:44, 2 February 2017

The NSAutoreleasePool class is a thin wrapper around the NSPushAutoreleasePool and NSPopAutoreleasePool functions.

#ifdef __cplusplus
extern "C" {
#endif
void *NSPushAutoreleasePool(NSUInteger capacity);
void NSPopAutoreleasePool(void* token);
#ifdef __cplusplus
}
#endif

Example:

static void MyMethod()
{
    void *pool = NSPushAutoreleasePool(0);
    [[[NSObject alloc] init] autorelease];
    NSPopAutoreleasePool(pool);
}

The "capacity" argument of NSPushAutoreleasePool only serves as a hint. It is unused in the current implementation.