I am creating an application for the new Apple Watch. I would like to use text-to-speech functionality. Right now, I'm using the old code (iPhone):
AVSpeechSynthesizer *synthesizer = [[AVSpeechSynthesizer alloc] init];
speechPaused = YES;
AVSpeechUtterance *utterance = [[AVSpeechUtterance alloc] initWithString:#""];
utterance.rate = 0.15;
utterance.voice = [AVSpeechSynthesisVoice voiceWithLanguage:#"it_IT"];
[synthesizer speakUtterance:utterance];
In my simulator it works correctly for the watch.
I am confused, because I've read on several forums that it is not possible to use text-to-speech.
I'd like to know if my code works in a real Apple Watch.
Thank you.
According to the documentation at developer.apple.com the AVSpeechSynthesizer API is available for watchOS 2+.
In addition, as of June 9, 2017, I can verify that I can play an AVSpeechUtterance on my wrist on an actual device, a Series 0 Apple Watch, 38mm, which can play from the built-in speaker or through bluetooth headphones (BeatsX).
This is not possible. In general, WatchKit is pretty limited right now. Third-party developers can currently not play audio from Apple Watch (Source: Apple employee via developer forum).
See here what's possible.
Related
I want to parse all images from my MacOS Photos Library, using PHAsset. However all examples I find are only working for iOS, like the one below, where the last line, which retrieves the assets is not available on macos framework:
NSMutableArray *photos = [[NSMutableArray alloc] init];
PHFetchOptions *allPhotosOptions = [[PHFetchOptions alloc] init];
allPhotosOptions.sortDescriptors = #[[NSSortDescriptor sortDescriptorWithKey:#"creationDate" ascending:YES]];
// Below compilation error as fetchAssetsWithMediaType is only on iOS framework
PHFetchResult *allPhotos = [PHAsset fetchAssetsWithMediaType:PHAssetMediaTypeImage options:allPhotosOptions];
What fetchAssets command should I use on MacOS (version 10.13), or is there another way to do so ?
The Photos framework — or at least, the main subset of that framework, which provides apps with read/write access to the entire Photos library — is not available in macOS.
Photos and PhotosUI are present in macOS, but only in support of specific app-extension features:
Photo Editing extensions. The user invokes these from the Photos app while in Edit mode for a single asset, and it provides direct access to the photo/video data for that asset, so it doesn’t even use the PHAsset class.
Photo Project extensions. These involve collections of assets and selectively loading data for each, so more of the PHAsset/PHImageManager system is present. However, it’s still a reduced subset compared to iOS (only what’s needed for a project extension, like fetching the assets in that project), and it’s accessible only to app extensions, not standalone apps.
If you’d like the full Photos framework on macOS, your best bet is to file a feature request with Apple.
As of macOS 10.15 Catalina, the Photos and PhotosUI frameworks are now available on the Mac, for both Catalyst and AppKit apps. So you should be able to transfer almost all iOS code that uses PhotoKit over to your Mac app now, as long as it has 10.15 as a minimum system requirement.
How do I open the App Store on the Apple TV to show all the apps created by a specific developer?
The iOS way, http://appstore.com/DEVNAME, does not work on Apple TV.
I use this method:
NSString* url = #"some url";
[[UIApplication sharedApplication] openURL:[NSURL url]];
To get the details of a developer,
https://itunes.apple.com/lookup?id=1074241891
To get all apps by that developer,
https://itunes.apple.com/lookup?id=1074241891&entity=software
To get the apps based on localization,
https://itunes.apple.com/lookup?id=1074241891&entity=software&country=gb
or
https://itunes.apple.com/gb/lookup?id=514675684&entity=software
I don't know why it is currently making me download a js file, it is suppose to display JSON response in browser? Maybe just temporary?
I want to implement an app by which voice & text chat between two iOS devcices under a network become possible. I dont need voice call facility to any phone like LinPhone or SiPhone. I have studied over them & found too complex for me. Is there any simple SDK to make this possible???
By the way, user identification may be done by e-mail verification....
I think one best way to do it using XMPP Framework. Using XMPP you can send files & text to other persons. Using it you can record voice message & send it across. There are some links for it:
GitHub Project Link for XMPP Chat
Building a Jabber Client for iOS: XMPP Setup
Hope it helps to you.
EDIT:
Apple's GameKit framework provides evertyhing you need to implement in-game chat.
The full documentation is here:
http://developer.apple.com/library/ios/#documentation/NetworkingInternet/Conceptual/GameKit_Guide/AddingVoiceChattoaMatch/AddingVoiceChattoaMatch.html#//apple_ref/doc/uid/TP40008304-CH11-SW11
Assuming you have allready connected the App to one or more other players using GameKit, you can start the voice chat like so:
-(void) startInGameChat {
//Set up audio session
AVAudioSession *audioSession = [AVAudioSession sharedInstance];
[audioSession setCategory:AVAudioSessionCategoryPlayAndRecord error:myErr];
[audioSession setActive: YES error: myErr];
GKMatch* match;
GKVoiceChat *teamChannel = [[match voiceChatWithName:#"redTeam"] retain];
GKVoiceChat *allChannel = [[match voiceChatWithName:#"allPlayers"] retain];
//Start the chat
[teamChannel start];
//Enable Mic
teamChannel.active = YES;
}
I'm developing an app which makes usage of AVPlayer, MPMediaItem and MPMediaQuery. It works as long as Itunes match. We start with a MPMediaQuery, then we perform some filtering leaving some MPMediaItems, then we have been using AVPlayer because:
1.- we also play noises during the song play
2.- we need to suscribe to play/stops events from ipod.
All this features are currently working, except if the ipod library has itunes match enabled. Even when AVPlayer status is playing, no sound comes. Is obvious that it is not triggering the song download from iCloud.
All the information I have about itunes match by the moment is this post:
MPMediaItem and iTunes Match
which states you can trigger the download by using a MPMusicPlayerController play call. For the reasons given above, we cannot make use of this class to control our own player.
I have two ideas on how to solve this problem:
A. Find a way to check if a song is already downloaded and available in the library to play using AVPlayer. If the song is not available let the user know that we don't support songs not available.
B. Find a way to trigger the download of the song just before it becomes the next item to play.
I still cannot find how to implement any of these solutions and I haven't found any related documentation, so I submitted my app with a warning message to prevent users to use this app if they are using itunes match.
On iOS 6 and up you can use [[item valueForProperty:MPMediaItemPropertyIsCloudItem] boolValue] to check if an item is already downloaded.
A. Find a way to check if a song is already downloaded and available
in the library to play using AVPlayer. If the song is not available
let the user know that we don't support songs not available.
This isn't perfect but it works in most cases. Songs downloaded from iTunes Match will be DRM free. So you can check the assets DRM flags, if it is not exportable then it needs to be downloaded. It is possible to get a false positive with audio books/pod casts but you are mostly safe.
MPMediaItem* item
NSURL* url = [item valueForProperty:MPMediaItemPropertyAssetURL];
AVURLAsset* assetToLoad = [[AVURLAsset alloc] initWithURL:url options:nil];
bool protectedCon = assetToLoad.hasProtectedContent;
bool exportable = true;
if (gApp.mSysVersionInt >= 5) {
exportable = assetToLoad.exportable; //4.3+
}
B. Find a way to trigger the download of the song just before it
becomes the next item to play.
You can try doing this will a muted MPMusicPlayerController, but there is no way to track when the song is downloaded and sometimes it takes a very long time.
Via the settings panel of your iPhone, you can add a subscription to a remote .ics calendar format. I have a Dutch iPhone app that does this from within the app (see the screenshot below, "abonneren op de agenda" means "subscribe to the calendar"), but there must be others too.
I want to mimic this behavior for a project of mine, but I can't find the API to do this with. It looks like it's not a part of EventKit, but because there's no app switching going on when you hit 'subscribe' in the example app I suspect it's also not a url scheme.
Who knows?
Try something like this:
NSString *url = #"http://server/filename.ics";
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:url]];
This shows an uialertview with the question to the user if he/she wants to subscribe.
;)