With iOS 9 i see in my iPhone console strange logs
These logs appears when the app connected to remote service,and maybe when the connection is slow, i use NSURLSession.
Someone has an idea about the meaning of this log, should I care of this:
-[NETAWDManager reportStats:metricID:] server 0x13cd19d70, container 0x13ce9dfe0, metrid 2686983, successfully reported:
<AWDLibnetcoreTCPConnectionReport: 0x13ce7af10> {
cellularFallbackReport = {
dataUsageSnapshotsAtNetworkEvents = (
{
bytesIn = 0;
bytesOut = 410;
}
);
"fallbackTimer_msecs" = 0;
fellback = 0;
networkEvents = (
"NETWORK_EVENT_DATA_STALL_AT_APP_LAYER"
);
"timeToNetworkEvents_msecs" = (
3325
);
};
clientIdentifier = "com.mydomain.myapp";
connectionStatisticsReport = {
DNSAnswersCached = 1;
"DNSResolvedTime_msecs" = 3;
RTTvariance = 169;
"appDataStallTimer_msecs" = 3;
appReportingDataStallCount = 1;
"bestRTT_msecs" = 359;
betterRouteEventCount = 0;
bytesDuplicate = 0;
bytesIn = 37000;
bytesOut = 410;
bytesOutOfOrder = 0;
bytesRetransmitted = 0;
cellularFallback = 0;
cellularRRCConnected = 0;
connected = 1;
connectedInterfaceType = "INTERFACE_TYPE_WIFI";
"connectionEstablishmentTime_msecs" = 308;
connectionReuseCount = 0;
"currentRTT_msecs" = 79;
"flowDuration_msecs" = 30750;
interfaceType = "INTERFACE_TYPE_WIFI";
kernelReportedStalls = 0;
kernelReportingConnectionStalled = 0;
kernelReportingReadStalled = 0;
kernelReportingWriteStalled = 0;
packetsDuplicate = 0;
packetsIn = 26;
packetsOut = 1;
packetsOutOfOrder = 0;
packetsRetransmitted = 0;
"smoothedRTT_msecs" = 275;
synRetransmissionCount = 0;
tcpFastOpen = 0;
"timeToConnectionEstablishment_msecs" = 315;
"timeToConnectionStart_msecs" = 7;
"timeToDNSResolved_msecs" = 7;
"timeToDNSStart_msecs" = 4;
trafficClass = 0;
};
delegated = 0;
reportReason = "REPORT_REASON_DATA_STALL_AT_APP_LAYER";
}
Based on the identifier cellularFallbackReport, this message may be related WiFi Assist. It's a new feature in iOS 9 that detects slow WiFi connections and automatically falls back to the phone's cellular radio.
This would be consistent with your observation that the log message occurs when you have a slow connection.
If you're able to reproduce the message reliably, try disabling WiFi Assist in settings and see if it disappears:
If that's really what it is, should you care about it? Probably not. The messages indicate the iOS system is dealing with network problems automatically on behalf of your app, and there's not much you can do about it.
Related
I am trying to save the following dictionary to my Firebase Database from an iOS/Objective-C application:
NSMutableDictionary* enrollmentDicc = {
"cleaning_tasks" = 3;
"eat_drink_dairy" = 2;
"eat_gluten" = 1;
"eat_meat" = 1;
"flor_lay_on_mat" = 2;
"garden" = 1;
"hours_spend_standing" = 1;
"level_of_flexibilitity" = 2;
"lift_or_carry" = "3,4,5";
"sit_bed_propped" = 3;
"strech_excercise" = "4,5,6";
"tight_calves" = 2;
"type_shoes" = "4,5,6";
"cause_back_pain" = "3,4";
"chill_sitting_room" = 1;
"cross_legs_sit_down" = 2;
diagnosis = "3,4";
"drive_everyday_hours" = 1;
email = "ignacio.orona+tw#gmail.com";
"has_diagnosis" = 1;
"hours_sitting_down" = 2;
"how_did_you_hear" = 3;
name = ignacio;
painLevelthisMoment = 10;
"pain_location" = 2;
processed = 0;
"sit_soft_couch" = 2;
"sleep_position" = 1;
treatments = "4,10";
For that purpose I use the following code:
-(void) apiPostEnrollment:(NSDictionary*)enrollmentDicc withCompletion:(SingleResponseCompletionBlock)completionBlock
{
_dbNodeRef = [[[FIRDatabase database] referenceWithPath:#"enrolledUsers"] childByAutoId];
[_dbNodeRef setValue:enrollmentDicc withCompletionBlock:^(NSError * _Nullable error, FIRDatabaseReference * _Nonnull ref){
completionBlock(ref,error);
}];
}
My problem is that the Dictionary does not get saved in Firebase, and I don't even have the response from the callback function (which ideally would give me some clue of why my data is not being stored. I've also turned on the Firebase debug mode with no luck either.
The problem actually was that there was a hidden character (\x) in some of the keys of the dictionary. Erased those wrong hidden characters that came from only god knows where, and it worked like charm.
I am getting battery status and others .
UIDevice *myDevice = [UIDevice currentDevice];
[myDevice setBatteryMonitoringEnabled:YES];
float batLeft = [myDevice batteryLevel];
int i=[myDevice batteryState];
int batinfo=(batLeft*100);
NSLog(#"Battry Level is :%d and Battery Status is :%d",batinfo,i);
switch (i)
{
case UIDeviceBatteryStateUnplugged:
{
break;
}
case UIDeviceBatteryStateCharging:
{
break;
}
case UIDeviceBatteryStateFull:
{
break;
}
default:
{
break;
}
}
Now i am trying to get the temperature details is it possible to get the battery temperature from device .
That is not possible and there is no public API to find . but I found the some answers in here May be it helps you , see once. But some private API you can get this details.
sample app you cannot use this if you deploy your app on the Apple Store, but it can be useful when deploying to TestFlight
Brother I gone through the answer for your question and which indicates that you can get and generally it shows the following states
Battery design capacity
Battery current raw capacity (in mAh)
Battery cycle count
Current battery temperature
Current battery voltage
Current battery discharge rate (device power consumption), in mA
Also following shows the results of battery
{
AdapterDetails = {
Amperage = 1000;
Description = "usb host";
FamilyCode = "-536854528";
PMUConfiguration = 1000;
Watts = 5;
};
AdapterInfo = 16384;
Amperage = 1000;
AppleRawCurrentCapacity = 1279;
AppleRawMaxCapacity = 1275;
AtCriticalLevel = 0;
AtWarnLevel = 0;
BatteryData = {
BatterySerialNumber = REDACTED;
ChemID = 355;
CycleCount = 524;
DesignCapacity = 1420;
Flags = 640;
FullAvailableCapacity = 1325;
ManufactureDate = REDACTED;
MaxCapacity = 1273;
MfgData = REDACTED;
QmaxCell0 = 1350;
StateOfCharge = 100;
Voltage = 4194;
};
BatteryInstalled = 1;
BatteryKey = "0003-default";
BootBBCapacity = 52;
BootCapacityEstimate = 2;
BootVoltage = 3518;
CFBundleIdentifier = "com.apple.driver.AppleD1815PMU";
ChargerConfiguration = 990;
CurrentCapacity = 1275;
CycleCount = 524;
DesignCapacity = 1420;
ExternalChargeCapable = 1;
ExternalConnected = 1;
FullyCharged = 1;
IOClass = AppleD1815PMUPowerSource;
IOFunctionParent64000000 = <>;
IOGeneralInterest = "IOCommand is not serializable";
IOInterruptControllers = (
IOInterruptController34000000,
IOInterruptController34000000,
IOInterruptController34000000,
IOInterruptController34000000
);
IOInterruptSpecifiers = (
<03000000>,
<26000000>,
<04000000>,
<24000000>
);
IOMatchCategory = AppleD1815PMUPowerSource;
IOPowerManagement = {
CurrentPowerState = 2;
DevicePowerState = 2;
MaxPowerState = 2;
};
IOProbeScore = 0;
IOProviderClass = AppleD1815PMU;
InstantAmperage = 0;
IsCharging = 0;
Location = 0;
Manufacturer = A;
MaxCapacity = 1275;
Model = "0003-A";
Serial = REDACTED;
Temperature = 2590;
TimeRemaining = 0;
UpdateTime = 1461830702;
Voltage = 4182;
"battery-data" = {
"0003-default" = <...>;
"0004-default" = <...>;
"0005-default" = <...};
"built-in" = 1;
}
Above things are from UIDeviceListener
I run with sample code I got below temparature
in EEPowerInformation.m class I put the breakpoint and check that.It is called and brings all information about battery.
- (void) listenerDataUpdated: (NSNotification *) notification
{
latestPowerDictionary = notification.userInfo;
NSLog(#"The latest Power Dictionary is - %#",latestPowerDictionary);
NSLog(#"The battery Temperature is - %#",[latestPowerDictionary objectForKey:#"Temperature"]);
if (self.delegate != nil)
[self.delegate powerInformationUpdated: self];
}
The Printed Statements are
The latest Power Dictionary is - {
AdapterDetails = {
Amperage = 1000;
Description = "usb host";
FamilyCode = "-536854528";
PMUConfiguration = 970;
Watts = 5;
};
AdapterInfo = 16384;
Amperage = 1000;
AppleChargeRateLimitIndex = 0;
AppleRawBrickIDVoltages = (
(
39,
420
)
);
AppleRawCurrentCapacity = 1084;
AppleRawExternalConnected = 1;
AppleRawMaxCapacity = 1221;
AtCriticalLevel = 0;
AtWarnLevel = 0;
BatteryInstalled = 1;
BatteryKey = "0003-default";
BootBBCapacity = 673;
BootCapacityEstimate = 29;
BootVoltage = 3810;
CFBundleIdentifier = "com.apple.driver.AppleARMPlatform";
ChargerConfiguration = 900;
CurrentCapacity = 1222;
CycleCount = 343;
DesignCapacity = 1430;
ExternalChargeCapable = 1;
ExternalConnected = 1;
FullyCharged = 0;
IOClass = AppleARMPMUCharger;
IOFunctionParent5E000000 = <>;
IOGeneralInterest = "IOCommand is not serializable";
IOMatchCategory = IODefaultMatchCategory;
IONameMatch = charger;
IONameMatched = charger;
IOPowerManagement = {
CapabilityFlags = 32832;
CurrentPowerState = 2;
DevicePowerState = 2;
MaxPowerState = 2;
};
IOProbeScore = 1000;
IOProviderClass = IOService;
InstantAmperage = 198;
IsCharging = 1;
Location = 0;
Manufacturer = A;
MaxCapacity = 1300;
Model = "0003-A";
Temperature = 3120;
TimeRemaining = 67;
UpdateTime = 1470665642;
Voltage = 4188;
"built-in" = 1;
}
Finally the Printed result of battery Temperature is
The battery Temperature is - 3120
if you don't need temperature number then it is useful to use ThermalState api
https://developer.apple.com/documentation/foundation/nsprocessinfothermalstate?language=objc
My App used to measure the Wifi Signal strength . For that I have used a private API in iOS7
libHandle = dlopen("/System/Library/SystemConfiguration/IPConfiguration.bundle/IPConfiguration", RTLD_LAZY);
But now it seems that Apple has removed it to some other Location in iOS8. As i am not able to find these methods .
apple80211Open = dlsym(libHandle, "Apple80211Open");
apple80211Bind = dlsym(libHandle, "Apple80211BindToInterface");
apple80211Close = dlsym(libHandle, "Apple80211Close");
apple80211GetInfoCopy = dlsym(libHandle, "Apple80211GetInfoCopy");
So do Any one has any idea where it may have been removed/replaced.
Is there any other way of measuring the Wifi Strength. (value something like : - 47)
Earlier apple80211GetInfoCopy used to return
"AUTH_TYPE" = {
"AUTH_LOWER" = 1;
"AUTH_UPPER" = 8;
};
BSSID = "74:XX:XX:60:1b:XX”; // Value changed for security.
CHANNEL = {
CHANNEL = 149;
"CHANNEL_FLAGS" = 20;
};
NOISE = {
"NOISE_CTL_AGR" = "-85";
"NOISE_UNIT" = 0;
};
"OP_MODE" = 1;
POWER = (
1
);
POWERSAVE = 1;
RATE = 135;
RSSI = {
"RSSI_CTL_AGR" = "-47";
"RSSI_UNIT" = "-1";
};
SSID = <6d506f72 74616c20 4343>;
"SSID_STR" = “Wifi XX; //Value Changed for Security
STATE = 4;
Where RSSI_CTL_AGR is what i need to fetch .
PS:The App is not for APPStore . Its for adhoc distribution.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 8 years ago.
Improve this question
I want to sort this array. alphabetically in ascending order on the _content field of title sub dictionary.
$1 = 0x0a2654c0 <__NSArrayM 0xa2654c0>(
{
"can_comment" = 0;
"count_comments" = 0;
"count_views" = 0;
"date_create" = 1382375149;
"date_update" = 1382375192;
description = {
"_content" = "";
};
farm = 4;
id = 72157636802321975;
"needs_interstitial" = 0;
photos = 3;
primary = 10406280064;
secret = 9731b9f97a;
server = 3767;
title = {
"_content" = Outdoors;
};
videos = 0;
"visibility_can_see_set" = 1;
},
{
"can_comment" = 0;
"count_comments" = 0;
"count_views" = 0;
"date_create" = 1382374546;
"date_update" = 1382374548;
description = {
"_content" = "";
};
farm = 8;
id = 72157636801994055;
"needs_interstitial" = 0;
photos = 10;
primary = 10406216685;
secret = 484f085b6d;
server = 7420;
title = {
"_content" = Cuba;
};
videos = 0;
"visibility_can_see_set" = 1;
},
{
"can_comment" = 0;
"count_comments" = 0;
"count_views" = 0;
"date_create" = 1382374276;
"date_update" = 1382374279;
description = {
"_content" = "";
};
farm = 3;
id = 72157636802362284;
"needs_interstitial" = 0;
photos = 6;
primary = 10406175565;
secret = f063b11d3e;
server = 2839;
title = {
"_content" = Afghanistan;
};
videos = 0;
"visibility_can_see_set" = 1;
},
.....
there are more than 50 element
try this
NSArray *sortedArray = [unsortedArray sortedArrayUsingDescriptors:[NSArray arrayWithObjects:[NSSortDescriptor sortDescriptorWithKey#"description._content" ascending:YES],nil];
I'm wondering is it possible to receive information about battery like: capacity (mA), voltage (V), cycle count within iOS?
I know UIDevice class, but battery level is not what I'm looking for.
Try UIDeviceListener, it basically steals the entire battery data dictionary from UIDevice without using any private APIs. It exposes tons of information:
{
AdapterDetails = {
Amperage = 1000;
Description = "usb host";
FamilyCode = "-536854528";
PMUConfiguration = 1000;
Watts = 5;
};
AdapterInfo = 16384;
Amperage = 1000;
AppleRawCurrentCapacity = 1279;
AppleRawMaxCapacity = 1275;
AtCriticalLevel = 0;
AtWarnLevel = 0;
BatteryData = {
BatterySerialNumber = REDACTED;
ChemID = 355;
CycleCount = 524;
DesignCapacity = 1420;
Flags = 640;
FullAvailableCapacity = 1325;
ManufactureDate = REDACTED;
MaxCapacity = 1273;
MfgData = REDACTED;
QmaxCell0 = 1350;
StateOfCharge = 100;
Voltage = 4194;
};
BatteryInstalled = 1;
BatteryKey = "0003-default";
BootBBCapacity = 52;
BootCapacityEstimate = 2;
BootVoltage = 3518;
CFBundleIdentifier = "com.apple.driver.AppleD1815PMU";
ChargerConfiguration = 990;
CurrentCapacity = 1275;
CycleCount = 524;
DesignCapacity = 1420;
ExternalChargeCapable = 1;
ExternalConnected = 1;
FullyCharged = 1;
IOClass = AppleD1815PMUPowerSource;
IOFunctionParent64000000 = <>;
IOGeneralInterest = "IOCommand is not serializable";
IOInterruptControllers = (
IOInterruptController34000000,
IOInterruptController34000000,
IOInterruptController34000000,
IOInterruptController34000000
);
IOInterruptSpecifiers = (
<03000000>,
<26000000>,
<04000000>,
<24000000>
);
IOMatchCategory = AppleD1815PMUPowerSource;
IOPowerManagement = {
CurrentPowerState = 2;
DevicePowerState = 2;
MaxPowerState = 2;
};
IOProbeScore = 0;
IOProviderClass = AppleD1815PMU;
InstantAmperage = 0;
IsCharging = 0;
Location = 0;
Manufacturer = A;
MaxCapacity = 1275;
Model = "0003-A";
Serial = REDACTED;
Temperature = 2590;
TimeRemaining = 0;
UpdateTime = 1461830702;
Voltage = 4182;
"battery-data" = {
"0003-default" = <...>;
"0004-default" = <...>;
"0005-default" = <...};
"built-in" = 1;
}
I might be wrong about this but using public APIs this is not possible. According to the UIDevice documentation, it appears the most you can do is get the battery charge level, its state, and enable battery monitoring.
Update 15th Feb 2019: Looks like iOS UIDevice API's now allow developers to get access to battery charge level for the device. Whooo! It currently exposes 4 different API's. By the looks of it these are not "private", in other words can be used safely by developers without Apple blocking your app from AppStore.
Getting the Device Battery State
var batteryLevel: Float (The battery charge level for the device).
var isBatteryMonitoringEnabled: Bool (A Boolean value indicating whether battery monitoring is enabled (true) or not (false)).
var batteryState: UIDevice.BatteryState (The battery state for the device).
enum UIDevice.BatteryState (The battery power state of the device).
Its possible to fetch Battery capacity and voltage using public API and which allowed in app store as well. Here is the link -
app store
:https://itunes.apple.com/us/app/system-monitor-ultimate/id740765454?mt=8
github : https://github.com/Asido/SystemMonitor
Yes it is possible..by using private framework iosDiagnosticsupport.Framework.
After doing some tests, i have certain data about battery rather overall logs for iDevice. Here are some links that might help you... iOS Diagnostics Part 3
Look at the JSystemInfoKit library.
You want to import the IOKit framework first (get the .framework file from here /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/IOKit.framework ) and IOKit headers (get those files from here) in your iOS project.
Here you can find the methods you need to use to get extensive battery information.
Plus, IOPSCopyPowerSourcesInfo (from IOPowerSources.h) returns a NSDictionary with more information like battery health.