Is it possible to programmatically obtain the installed version of Crashlytics/Fabric? If so, how?
Yes; see Crashlytics.h:
#interface Crashlytics : NSObject
#property (nonatomic, readonly, copy) NSString *APIKey;
#property (nonatomic, readonly, copy) NSString *version; // !!!!!
#property (nonatomic, assign) BOOL debugMode;
...
So that would be:
NSLog(#"Using Crashlytics version %#", [[Crashlytics sharedInstance] version]);
Related
Can any one suggest me a m3u8 parser that works on iOS 10. I used this but its giving me errors
M3U8_BASE_URL undecleared indentifier, No visible interface declared
in NSString for isExtendedM3Ufile these kind of errors,, more than 17
in NSString+m3u8.m. I want to pass an m3u8 file to AudioStreamer.
Please help me.
Thanks
According to the screenshot, I copied all the files into one folder and import to the project.
Then m3u8 file URL to the M3U8PlaylistModel
let playlistModel = M3U8PlaylistModel(url: self.m3u8_url)
guard let m3u8PlaylistModel = playlistModel else {
return
}
guard let masterPlaylist = m3u8PlaylistModel.masterPlaylist else {
return
}
guard let streamList = masterPlaylist.xStreamList else {
return
}
streamList.sortByBandwidth(inOrder: .orderedAscending)
for i in 0 ..< streamList.count {
if let extXStreamInf = streamList.xStreamInf(at: i){
/* you can get below properties, using this extXStreamInf object
#property (nonatomic, readonly, assign) NSInteger bandwidth;
#property (nonatomic, readonly, assign) NSInteger programId; // removed by draft 12
#property (nonatomic, readonly, copy) NSArray *codecs;
#property (nonatomic, readonly) MediaResoulution resolution;
#property (nonatomic, readonly, copy) NSString *audio;
#property (nonatomic, readonly, copy) NSString *video;
#property (nonatomic, readonly, copy) NSString *subtitles;
#property (nonatomic, readonly, copy) NSString *closedCaptions;
#property (nonatomic, readonly, copy) NSURL *URI;
*/
}
}
I have the following model and I'm using Realm:
#interface GUIRoutineModel : GUIModel # GUIModel is a subclass of RLMObject
#property (nonatomic, retain) NSString *dateCreated;
#property (nonatomic, retain) NSString *dateModified;
#property (nonatomic, retain) NSString *name;
#property (nonatomic, retain) NSString *type;
#property NSInteger userId;
#property int routineId; #also have same issue using NSInteger
#end
When I call:
// Persist to Realm DB
RLMRealm *realm = [RLMRealm defaultRealm];
[realm transactionWithBlock:^{
[realm addObject:routineModel];
}];
I get the following error:
'Property 'routineId' requires a protocol defining the contained type - example: NSNumber<RLMInt>.'
I have tried changing the routineId property to NSNumber<RLMint>, but that didn't work either. Can anyone tell me what I'm doing wrong?
UPDATE:
Here is another version of the model that I have tried:
#interface GUIRoutineModel : GUIModel
#property (nonatomic, retain) NSString *dateCreated;
#property (nonatomic, retain) NSString *dateModified;
#property (nonatomic, retain) NSString *name;
#property (nonatomic, retain) NSString *type;
#property NSInteger userId;
#property NSNumber<RLMInt> *routineId;
#end
The Property requires a protocol defining the contained type error is only generated by Realm for a property of type NSNumber without a protocol annotating the expected concrete type. That means it cannot be generated for either of the model classes you mention. It's likely you have a another routineId property elsewhere in your app that is triggering the error.
I know my question is a little confusing so please allow me to elaborate.
JSON Parsing Lib : JSONModelLib
MODEL
#import "JsonModelLib/JSONModel.h"
#interface CustomerDetailsModel : JSONModel
#property (nonatomic, strong) NSString *description;
#property (nonatomic, strong) NSString *firstName;
#property (nonatomic, strong) NSString *lastName;
#property (nonatomic, strong) NSString *activatedTill;
#property (nonatomic, strong) NSString *birthdate;
#property (nonatomic, strong) NSString *phone;
#property (nonatomic, strong) NSString *id;
#property (nonatomic, strong) NSString *statusCode;
#end
JSON string
NSString* str = #"\
{\
\"description\": \"None\",\
\"firstName\": \"vikas\",\
\"lastName\": \"bansal\",\
\"activatedTill\": \"2016-01-17 09:04:11\",\
\"email\": \"bansal\",\
\"birthdate\": \"None\",\
\"phone\": \"None\",\
\"id\": \"1053\",\
\"statusCode\": \"1600\"\
}\
";
Parsing
CustomerDetailsModel* c = [[CustomerDetailsModel alloc] initWithString:str error:nil];
PROBLEM
The problem is that some time when json does not contain a variable that exists in MODEL Why?? becuase the REST API I am using does not render variable into JSON if there is no value in it.
For an example suppose there is no value in birthdate then it will not be included in JSON so when I will try to parse the JSON what I will get is an error.
Please help or please suggest what should I do
Note: I have already gone far ahead with JsonModelLib so if you asking me to use something else or some other lib then I will be a great pain for me. Please please please try to suggest something without changing the lib if it is possible
Many many thanks...
Use an optional model property - there's an example in the repo's README.
https://github.com/icanzilb/JSONModel#optional-properties-ie-can-be-missing-or-null
I have object
#interface Hourly (CoreDataProperties)
#property (nullable, nonatomic, retain) NSDate *dt;
#property (nullable, nonatomic, retain) NSNumber *temp;
#property (nullable, nonatomic, retain) NSNumber *temp_min;
#property (nullable, nonatomic, retain) NSNumber *temp_max;
#property (nullable, nonatomic, retain) NSNumber *humidity;
#property (nullable, nonatomic, retain) NSNumber *pressure;
#property (nullable, nonatomic, retain) NSString *main;
#property (nullable, nonatomic, retain) NSString *des;
#property (nullable, nonatomic, retain) NSString *icon;
#end
And url
http://api.openweathermap.org/data/2.5/forecast/dayly?lat=35&lon=139&cnt=2
I can' add json to object by jsonmodel pod because weather in list is a array .
#Ngọc Thái:
I don't really understand your question. But, if you want parse from JSON (contain array of objects) to object.
Simple, you can try it: https://github.com/elado/jastor#arrays
Hope this help!
Try my project BWJSONMatcher. It helps you easily convert a json string to NSArray:
NSArray *dataArray = [BWJSONMatcher matchJSON:YOURJSONSTRING withClass:[Hourly class]];
The library is fully opensourced and under MIT license.
I'd like to sort those products retrieved from itunesconnect.apple.com by AppleID that are online generated automatically.
I checked SKProduct, but only find these propertis, none of which are referred to Apple ID,
#property(nonatomic, readonly) NSString *localizedDescription
#property(nonatomic, readonly) NSString *localizedTitle
#property(nonatomic, readonly) NSDecimalNumber *price
#property(nonatomic, readonly) NSLocale *priceLocale
#property(nonatomic, readonly) NSString *productIdentifier
#property(nonatomic, readonly, getter=isDownloadable) BOOL downloadable
#property(nonatomic, readonly) NSArray *downloadContentLengths
#property(nonatomic, readonly) NSString *downloadContentVersion
Does anyone know about it?