UIWebView - NSStringWithFormat [closed] - ios

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I'm trying to get a UIWebView working with the following code:
NSString *urlAddress = [NSString stringWithFormat: #"http://www.wikipedia.org/wiki/%#",recipe.name];
recipe.name is the entity and property from the core data model
I used NSLog to test the recipe.name and it is outputting correctly to the console
I tried this with just a plain URL and it works fine:
NSString *urlAddress = [NSString stringWithFormat: #"http://www.wikipedia.org/wiki/soup"];

Initialize your UIWebView.
Create an NSURL-object containing your url(using +[NSURL URLWithString:] for example).
Create an NSURLRequest-object with the created NSURL-object.
load the NSURLRequest in your webView.
Voila
:)

Related

Getting video details in flutter/dart [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 3 years ago.
Improve this question
I have a video inside my device but I want to extract the following details of the video(In flutter/dart)-
1.When the video was taken.
2.Duration of the video
3.Type of the Video
4.When the video was taken
Currently i am using Ff-mpeg plugin but it is taking too long time before it returns metadata information.
You may need to use FFMPEG as follows
import 'package:flutter_ffmpeg/flutter_ffmpeg.dart';
class VideoDetail {
final FlutterFFmpeg _flutterFFmpeg = new FlutterFFmpeg();
VideoDetail() {
_flutterFFmpeg
.getMediaInformation("<file path or uri>")
.then((info) => print(info));
}
}
Do not forget to add dependency
flutter_ffmpeg: ^0.1.1
For more information please visit
https://pub.dartlang.org/packages/flutter_ffmpeg

How to create a simple API in Firebase? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 6 years ago.
Improve this question
I have never worked on the backend and never created an API, all I know is to handle the JSON response, This doesn't help much, but I do not understand "PUT - Writing Data".
However, I just want to know that how can I create a simple dictionary of multiple arrays or key-values as rest API, So that it can be fetched and i can show the data in table view etc.
According to Firebase Documentations, if you wanna create a node on Firebase realtime database, you can simply set a value to any key you want. The value here should be NSDictionary.
This is the code you can refer to:
// create a new node
[[[_ref child:#"users"] child:user.uid] setValue:#{#"username": username}];
// you can also use update to create a new node
NSString *key = [[_ref child:#"posts"] childByAutoId].key;
NSDictionary *post = #{#"uid": userID,
#"author": username,
#"title": title,
#"body": body};
NSDictionary *childUpdates = #{[#"/posts/" stringByAppendingString:key]: post,
[NSString stringWithFormat:#"/user-posts/%#/%#/", userID, key]: post};
[_ref updateChildValues:childUpdates];
Hope it helps.

Guess sound game, ios [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 9 years ago.
Improve this question
I want to make an easy "game". When player start the game, it plays sound (for example dog bark) and player has to guess to which animal (musical instrument..) the sound belongs to.
I dont know how to make the "logic" of this program - how to connect image with its sound.
I was thinking about something like this:
if app plays sound1 then right image is image1, if plays sound2 then right image is image2...but what if I have 100 images?
It is not possible doing it like this. Do you have any ideas please?
You will have to map the sound files with the images.
One way, as you suggested would be to prefix them with an ID, for example:
001_img.png - 001_sound.mp3
002_img.png - 002_sound.mp3
003_img.png - 003_sound.mp3
004_img.png - 004_sound.mp3
005_img.png - 005_sound.mp3
And use a code snippet below to generate the filenames:
for (int assetIndex = 0; assetIndex < 6; assetIndex++)
{
NSString *imageFilename = [NSString stringWithFormat:#"%03i_img.png", assetIndex + 1];
NSString *soundFilename = [NSString stringWithFormat:#"%03i_sound.mp3", assetIndex + 1];
}

Get latest inserted object FatFractal [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions concerning problems with code you've written must describe the specific problem — and include valid code to reproduce it — in the question itself. See SSCCE.org for guidance.
Closed 9 years ago.
Improve this question
I'm using FatFractal for my backend in a iPhone-app. Been searching the web and FatFractal docs without any luck.
I want to retrieve the latest object in a collection from a grabbag:
NSArray *result = [[Store ff] grabBagGetAllForObj:thread grabBagName:#"messages" withQuery:#"Get the latest inserted object" error:&err];
Probably the best way to do this is to construct the full query yourself and then use the standard getArrayFromUri: method. Taking your example, this would look like:
FatFractal *ff = [Store ff];
NSString *query = [NSString stringWithFormat:
#"%#/messages?sort=createdAt desc&start=0&count=1",
[ff metaDataForObj:thread].ffUrl];
NSArray *result = [ff getArrayFromUri:query];
For more info, see http://fatfractal.com/prod/docs/queries/#sorting-and-limiting-results.

Parse this Json to NSmutablearray [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
Improve this question
i've this unique text plain
{"id":"AALI.NG","data":["AALI","NG",19312,0,0,0,0,0,0,0,0,0,0,0,70,0,0,0,0,0,0,0,0,0,0,0,0],"req":"SQ"}
{"id":"AALI.RG","data":["AALI","RG",19500,0,0,0,0,0,0,0,0,0,0,0,26,0,0,0,0,0,0,0,0,0,0,0,0],"req":"SQ"}
{"id":"AALI.TN","data":["AALI","TN",19500,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"req":"SQ"}
{"id":"ABBA.NG","data":["ABBA","NG",60,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"req":"SQ"}
{"id":"ABBA.RG","data":["ABBA","RG",85,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0],"req":"SQ"}
{"id":"ABBA.TN","data":["ABBA","TN",85,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"req":"SQ"}
{"id":"ABDA.NG","data":["ABDA","NG",3500,0,0,0,0,0,0,0,0,0,0,0,6000,0,0,0,0,0,0,0,0,0,0,0,0],"req":"SQ"}
then i change it to :
{"stockQuote":[{"id":"AALI.NG","data":["AALI","NG",19312,0,0,0,0,0,0,0,0,0,0,0,70,0,0,0,0,0,0,0,0,0,0,0,0],"req":"SQ"},
{"id":"AALI.RG","data":["AALI","RG",19500,0,0,0,0,0,0,0,0,0,0,0,26,0,0,0,0,0,0,0,0,0,0,0,0],"req":"SQ"},
{"id":"AALI.TN","data":["AALI","TN",19500,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"req":"SQ"},
{"id":"ABBA.NG","data":["ABBA","NG",60,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"req":"SQ"},
{"id":"ABBA.RG","data":["ABBA","RG",85,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0],"req":"SQ"},
{"id":"ABBA.TN","data":["ABBA","TN",85,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"req":"SQ"},
{"id":"ABDA.NG","data":["ABDA","NG",3500,0,0,0,0,0,0,0,0,0,0,0,6000,0,0,0,0,0,0,0,0,0,0,0,0],"req":"SQ"}]}
basicly type of data i get from server is text/plain and i need to add {"stockQuote":[, "," and also }]} to make it like json...
the question is, how to parse it to json an NSMutableArray then i draw it to UITableView, how to do it?? should i change it to NSDictionary first and then insert it to NSMutableArray?
Your second JSON is just an NSDictionary with a single object that is an NSArray. So just take your normal array that you have in the first JSON, and do this:
NSArray *jsonArray = [jsonDic objectForKey:#"stockQuote"];
where jsonDic is your json's parse object with NSJSONSerialization method.

Resources