Can you help me on the below issue
on iOS 6.x, I used gethostuuid system call to get unique ID of iDevice, I just wonder if my app submit for iOS 7.x, it will be rejected by calling this api (gethostuuid)?
Is there any way to get Unique ID on iOS 7 (using C language) instead of calling gethostuuid?
Thanks.
If you want to get your app specific Unique key
why not try this
UIDevice *myDevice=[UIDevice currentDevice];
NSString *UUID = [[myDevice identifierForVendor] UUIDString];
KeyChainItemWrapper.h may help
you can see:
https://developer.apple.com/library/ios/samplecode/GenericKeychain/Listings/Classes_KeychainItemWrapper_m.html
Related
I am trying to integrate a payment API in my application and one of the required field is the device fingerprint. I have googled and all I got was the fingerprint scanner and touch Id support which aren't what I need. Any ideas?
Realistically speaking, perhaps the simplest thing you can do is not to obtain or calculate a unique device identifier, but to assign each specific installation of your app a unique code (which will therefore change if the app is uninstalled and reinstalled).
I'll try to give you an example.
In the init() method of the main class, you can add this code:
// Register the device (assigning it an unique deviceId)
// The deviceId is used also by: https://www.codenameone.com/javadoc/com/codename1/io/Util.html#getUUID--
registerDevice();
Your registerDevice() implementation could set the deviceId to identify this app installation. The best and most reliable solution, in this case, is to get a UUID from your server, e.g. like this code:
// Sets the device unique identifier
Rest.get(Server.getRestServerURL() + "/uniqueIdentifier").fetchAsString((Response<String> response) -> {
String deviceId = response.getResponseData();
Preferences.set("deviceId", deviceId);
Log.p("DeviceId: " + deviceId, Log.INFO);
});
The server-side code is quite simple. Staying in the Java world, and assuming we have a Spring Boot server, the code could be:
#GetMapping("/uniqueIdentifier")
#ResponseBody
public String uniqueIdentifier() {
return UUID.randomUUID().toString().replace("-", "");
}
This solution should be enough. Note that UUIDs must be unique, but they are not designed to be unpredictable. You can see a discussion about this here: https://stackoverflow.com/a/41156/1277576
Alternatively, if your code is to be client-side only, read this Javadoc carefully: https://www.codenameone.com/javadoc/com/codename1/io/Util.html#getUUID--
Util.getUUID() returns a pseudo-random Universally Unique Identifier in its canonical textual representation. This could be enough in most cases.
These are just basic suggestions. Obviously you will need to develop the code so that the deviceId is requested once.
Since iOS 11.2, clearing a single notification from my app seems to clear them all. I can't seem to figure out what's happening as no code was changed.
My UNNotificationRequest are created with GUUIDs to be universally unique (since my app allows users to create multiple alerts based on the same reminder type).
What must I be doing wrong?
UNMutableNotificationContent *alertContent = [[UNMutableNotificationContent alloc] init];
alertContent.categoryIdentifier = ALERT_CATEGORY_ALERTS;
alertContent.body = task.title;
alertContent.userInfo = ... a dictionary of stuff
...
NSDateComponents *dateCompos = [localGregCal components:NSCalendarUnitYear | NSCalendarUnitMonth
| NSCalendarUnitDay | NSCalendarUnitHour |
NSCalendarUnitMinute | NSCalendarUnitSecond fromDate:deliveryDate];
UNCalendarNotificationTrigger *alertTrigger = [UNCalendarNotificationTrigger
triggerWithDateMatchingComponents:dateCompos repeats:NO];
UNNotificationRequest *notifRequest = [UNNotificationRequest requestWithIdentifier:NEW_GUUID
content:alertContent trigger:alertTrigger];
Appears to be an iOS 11.2.0-.5 issue:
rdar://36575570: iOS 11.2.2: Clearing/Action on notification causes …
I have also face the same issue only with iOS 11.2 and now I have update my OS 11.2 to 11.3. Now it's working fine for me.
So this is the OS related bug which is resolved in iOS 11.3.
Another cause/solution:
If you are clearing a single notification upon arrival of a silent notification without an alert, make sure that aps.batch is not set to 0. Make sure that aps.batch is not included in your message at all.
I'm implementing Offline Playback with HLS Fairplay following the demo in the FairPlay Streaming Server SDK v4.0.1 that uses AVContentSessionKey.
I download three contents, each content is downloaded and persisted correctly, both the .movpkg and its content key on the documents directory, when I turn off the WIFI these three contents downloaded plays correctly without any problems, before playing Im using this code:
let urlAsset = element.urlAsset!
ContentKeyManager.shared.contentKeySession.addContentKeyRecipient(urlAsset)
if !urlAsset.resourceLoader.preloadsEligibleContentKeys {
urlAsset.resourceLoader.preloadsEligibleContentKeys = true
}
self.present(playerViewController, animated: true, completion: {
AssetPlaybackManager.sharedManager.setAssetForPlayback(urlAsset)
})
So far so good. But the problem is when I close the application (Home button to close applications) and then play the downloaded contents, only the last content downloaded plays correctly, the other ones (first and second) send these error on the console.
Error Domain=AVFoundationErrorDomain Code=-11800 "The operation could not be completed"
UserInfo={NSUnderlyingError=0x1c065d760 {Error Domain=NSOSStatusErrorDomain Code=-16227 "(null)"},
NSLocalizedFailureReason=An unknown error occurred (-16227),
NSURL=file:///private/var/mobile/Containers/Data/Application/A950D8DB-B711-47E3-AAF5-C95CC9682430/Library/com.apple.UserManagedAssets.kkG8Ih/644986_7798B8476A473F68.movpkg/, NSLocalizedDescription=The operation could not be completed}
I double check the .movpkg with the keys in the documents directory and appears correctly
/Documents/.keys/one-key
/Documents/.keys/two-key
/Documents/.keys/three-key
Before the error occurs the ContentKeyDelegate is called and the key is loaded and passed to the request correctly.
if persistableContentKeyExistsOnDisk(withContentKeyIdentifier: assetIDString) {
let urlToPersistableKey = urlForPersistableContentKey(withContentKeyIdentifier: assetIDString)
guard let contentKey = FileManager.default.contents(atPath: urlToPersistableKey.path) else {
/
pendingPersistableContentKeyIdentifiers.remove(assetIDString)
return
}
/
Create an AVContentKeyResponse from the persistent key data to use for requesting a key for
decrypting content.
*/
let keyResponse = AVContentKeyResponse(fairPlayStreamingKeyResponseData: contentKey)
/
keyRequest.processContentKeyResponse(keyResponse)
return
}
If I print the contentKeyRecipients the three contents appears correctly
- (lldb) po
ContentKeyManager.shared.contentKeySession.contentKeyRecipients ▿ 3
elements
- 0 : AVURLAsset: 0x1c0234d40, URL = file:///private/var/mobile/Containers/Data/Application/E791A4DE-4261-46B7-A84D-D10B27035FAE/Library/com.apple.UserManagedAssets.kkG8Ih/539628_20469336224AA388.movpkg
- 1 : AVURLAsset: 0x1c0234fa0, URL = file:///private/var/mobile/Containers/Data/Application/E791A4DE-4261-46B7-A84D-D10B27035FAE/Library/com.apple.UserManagedAssets.kkG8Ih/644986_7798B8476A473F68.movpkg
- 2 : AVURLAsset: 0x1c42391c0, URL = file:///private/var/mobile/Containers/Data/Application/E791A4DE-4261-46B7-A84D-D10B27035FAE/Library/com.apple.UserManagedAssets.kkG8Ih/573744_62377F9549C45B93.movpkg
My tests are in iOS 11.1.2 and iOS 11.2 beta 2
I'm not sure what is happening, but seems to be a problem with the persisted key, I don't how if each content needs to be associated with one AVContentKeySession at time.
If someone faced a similar problem, any help would be appreciated.
Thanks in advance
I'm having similar issue.
however, since I need to support iOS 10, I'm not using the new AVContentKeyResponse class. Instead, I'm loading the persistent content key myself, and pass it to the loading request.
Anyway, I'm getting exact the same error as you and same behavior. One thing to note is that if I remove the code that loads persistent content key from disk, and always fetch the key from server, then everything works. But this defeats the purpose of "offline" playback...
So it seems like the system thinks the persistent content key is invalid...
Which TLLV you used on the server side to specify Rental Duration of the downloaded content? Did you use Content key duration TLLV or Offline Key TLLV? If you used Offline Key TLLV you need to double check that "Content ID" field is different for every downloaded movie.
We had encounter this error message, too.
It will happen when content exceed over expiration date which set in server side.
For example :
We give 10 minutes of expiration date for Video A
Download this Video A, and verify CKC delivery correctly (print log)
Play Video A without connection
Take a break (after 11 minutes), close App, and launch App again, select Video A to Play
Show below error message from AVPlayerItem.error.description:
Error Domain=AVFoundationErrorDomain Code=-11800
"The operation could not be completed" UserInfo={NSLocalizedFailureReason=An unknown error occurred (-16227),
NSLocalizedDescription=The operation could not be completed, NSUnderlyingError=0x1d4257310
{Error Domain=NSOSStatusErrorDomain Code=-16227 "(null)"}}
You can refresh encrypted data again by
AVAssetResourceLoaderDelegate
or use AVContentSessionKey
Reference : https://developer.apple.com/videos/play/wwdc2018/507/
Make sure you set correct offline content identifier on a serverside. The identifier you set should be associated with the specific rendition/stream allowed by the license. This helped me.
console.log(Ext.os.Name)
prints the name for OS("Windows"==>in windows machine) for all browser,
But I want to know there is anyway to get the current Platform("chrome","safari","firefox","windows","ios","ios-classic") value based upon the theme currently loaded by sencha.
Because i need configure some of my component based on the browser also.
I dont need Browser name or os name, i need the platform variable used
by sencha framework. like when we using the ios6 it will take the
platform parameter as ios-classic we also pass the platform parameter
in link like http://cdn.sencha.com/touch/sencha-touch-2.3.1a/built-examples/kitchensink/index.html?platform=ios-classic# or
http://cdn.sencha.com/touch/sencha-touch-2.3.1a/built-examples/kitchensink/index.html?platform=windows# this will load the ios6 and windows theme respectively even we use any kind of browser in any OS.
you can use Ext.browser
console.log(Ext.browser.name);
console.log(Ext.browser.version);
Ext.device will not work for browser as it works only for native packing.
you can get what theme is applied by using Ext.theme.name
Ext.theme.name
getting platform for them is not directly provided in Sencha Touch. you can check implementation for that in sencha\app\microloader
I found the following configurations on http://docs-origin.sencha.com/extjs/4.2.2/#!/api/Ext , from that what i have observed is, we can't find the browser's name but we can check whether it is chrome or else like that...
example :
console.log(Ext.isWindows);
true //because i am working in windows
chromeVersion
firefoxVersion
ieVersion
isChrome
isFF10
isFF3_0
isFF3_5
isFF3_6
isFF4
isFF5
isGecko
isGecko10
isGecko3
isGecko4
isGecko5
isIE
isIE10
isIE10m
isIE10p
isIE11
isIE11m
isIE11p
isIE6
isIE7
isIE7m
isIE7p
isIE8
isIE8m
isIE8p
isIE9
isIE9m
isIE9p
isLinux
isMac
isOpera
isOpera10_5
isSafari
isSafari2
isSafari3
isSafari4
isSafari5
isSafari5_0
isWebKit
isWindows
name
operaVersion
safariVersion
In Sencha Touch 2.3 the Ext.device.Device singleton will give you information on the platform and the Ext.device.Browser will give you information on the browser.
I am incorporating the iPod player in my app. I am able to create a queue, then play the songs. I am not able to get the current song's property values. I have registered for the notifications and the log shows the notifications are bing triggered.
MPMediaItem *currentItem = self.musicPlayer.nowPlayingItem;
NSLog(#"currentItem = %#", currentItem);
Log output shows: currentItem = (null)
I'm running Xcode 4.5.2 iOS 6.0.
Any help is greatly appreciated.
For anyone else who may run into the same issue, the problem was that I synced my Music after running my application. You need to observe for Library changes:
MPMediaLibraryDidChangeNotification
[[MPMediaLibrary defaultLibrary] beginGeneratingLibraryChangeNotifications];
You wrote NSLog(#"currentItem = %#", currentItem); in your codes but maybe you have not got a full understand of what MPMediaItem is.
MPMediaItem is not NSString, and that's why you got null here. MPMediaItem has a lot of properties including song title, album name and artist name. To access the properties of MPMediaItem such as the title, use valueForProperty: method.
NSLog(#"currentItem = %#", [currentItem valueForProperty:MPMediaItemPropertyTitle])
Something like this.
I also had the problem that I mixed by accident the application player
[MPMusicPlayerController applicationMusicPlayer]
and the ipod player
[MPMusicPlayerController iPodMusicPlayer]
I was using the iPodMusicPlayer for playing music and tried to adjust the volume of the applicationMusicPlayer by accident.
So just beware not to mix them unintentionally ;-)